nx-linaria
A Nx Webpack plugin for enabling Linaria loader for babel projects.
Installation
Add the plugin to your workspace:
npm i -D nx-linaria @linaria/core @linaria/react @linaria/babel-preset
Compose the plugin in Webpack config:
//@ts-check
const { composePlugins, withNx } = require("@nrwl/webpack");
const { withReact } = require("@nrwl/react");
const { withLinaria } = require("nx-linaria");
module.exports = composePlugins(
withNx(),
withReact(),
withLinaria(),
(config) => {
return config;
}
);
Include Linaria's babel preset in .babelrc
:
{
"presets": [
[
"@nrwl/react/babel",
{
"runtime": "automatic"
}
],
"@linaria"
],
"plugins": []
}