Reputation: 4946
I'm new to Razzle and I'm trying to learn it. I took a Material-UI dashboard app and am trying to "import" or "convert" it into my blank-ish razzle app.
I copied the contents of the CRA app's ./src
into my razzle source at the right spot, referenced the right components, etc.
At first, Razzle didn't like the @import
statements in the CRA repo. I fixed that by using npm to install razzle-plugin-scss
, which got me past that issue. But now I'm hitting something I don't understand at all (nor even how to go about finding a resolution):
{ Error: Cannot find module 'css-loader/locals'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)
at Function.resolve (internal/modules/cjs/helpers.js:19:19)
at module.exports (/home/user/my-project/node_modules/razzle-plugin-scss/index.js:106:31)
at runPlugin (/home/user/my-project/node_modules/razzle/config/runPlugin.js:26:10)
at plugins.forEach.plugin (/home/user/my-project/node_modules/razzle/config/createConfig.js:549:16)
at Array.forEach (<anonymous>)
at module.exports (/home/user/my-project/node_modules/razzle/config/createConfig.js:548:13)
at main (/home/user/my-project/node_modules/razzle/scripts/start.js:48:22)
at processTicksAndRejections (internal/process/next_tick.js:81:5) code: 'MODULE_NOT_FOUND' }
I looked in css-loader
and found that you (maybe?) need to instruct it to export locals with the exportOnlyLocals: true
webpack directive. I'm not sure how to do that in Razzle. I found this page that shows an example of how to configure it through razzle.config.js
, but it assumes more knowledge than I have.
How can I configure webpack in Razzle to ... do something? ... to tell the underlying webpack plugin css-loader
to load locals?
Any help is much appreciated.
Update
It looks like this is caused by a breaking change in css-loader
when it moved to v2.0.0
. I still don't know what the solution is, but that's getting me closer.
Upvotes: 0
Views: 881
Reputation: 4946
I ended up reverting to css-loader
version 1.0.1
to fix the problem.
Upvotes: 0