Sometimes it's nice to break out your CSS into a separate .css file. I've tried to do the following:
pages/
└── index
├── index.css
├── index.js
└── component.js
Then in the index.js, I've tried to do:
import css from './index.css'
And in next.config.js:
module.exports = {
webpack: function (config) {
config.module.loaders = (config.module.loaders || []).concat({
test: /\.css$/, loader: 'raw'
})
return config
}
}
But unfortunately, it keeps giving me:
ERROR Failed to compile with 1 errors
This dependency was not found in node_modules:
* ./index.css
Seems like it's not resolving to the right place for some reason, the local component.js works though via import component from './component.js', so I'm not sure what's going on here.
Sometimes it's nice to break out your CSS into a separate
.cssfile. I've tried to do the following:Then in the index.js, I've tried to do:
And in next.config.js:
But unfortunately, it keeps giving me:
Seems like it's not resolving to the right place for some reason, the local
component.jsworks though viaimport component from './component.js', so I'm not sure what's going on here.