I want to use Linaria library(https://github.com/callstack/linaria) with nextJS. Now, I implemented according to the document. But occurred the next error.
Global CSS cannot be imported from files other than your Custom . Please move all global CSS imports to pages/_app.js. Read more: https://err.sh/next.js/css-global
I understood this error. But I wondered. How can I use Linaria with NextJS?
- .babelrc
{
"presets": ["next/babel", "linaria/babel"],
}
- next.config.js
const path = require("path");
module.exports = {
webpackDevMiddleware: (config) => {
config.watchOptions = {
poll: 1000,
aggregateTimeout: 300,
};
return config;
},
webpack: (config) => {
config.module.rules.push({
test: /\.tsx$/,
use: [
{
loader: "linaria/loader",
options: {
sourceMap: process.env.NODE_ENV !== "production",
},
},
],
});
return config;
},
};