I'm using Linaria with Next.js which generates unique hashes for each className so it is safe to import the generated CSS globally.
Currently importing global CSS is only allowed in _app.js.
It would be great if we had the option to allow css files to be imported from any file with a configuration option in next.config.js:
``` js
module.exports = {
css: {
importAsGlobal: true
}
}
````
The built-in CSS feature was added in next.js version 9.2. This feature allows you to handle files using file naming conventions.
Yeah it's pretty great when writing css modules or global stylesheets, although as linaria inserts css import statements into each file that imports linaria, and the built-in css support does not allow importing global css files into any file (only _app.js), linaria currently does not work with built-in css support.
I found this thread trying to make Linaria work again as well.
If you use the next-css or next-sass plugins then it will automatically disable the new CSS handling and allow global imports.
Closing as duplicate of #12079
Most helpful comment
If you use the
next-cssornext-sassplugins then it will automatically disable the new CSS handling and allow global imports.