As a newcomer to webpack, I have been experimenting with creating my own build by modifying an existing one. One issue I encountered was the css not compiling, so I took the following steps:
- Confirmed that there were no css loaders already included in the webpack config file
- Executed
npm install css-loader --save-dev
- Added loaders
- Inserted
into my entry .js fileimport css from './static/css/style.css';
- Made some random changes to my css for testing purposes
To clarify, my loaders appeared as follows:
loaders: [
{ ...babel loader... },
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.png$/, loader: "url-loader?limit=100000" },
{ test: /\.jpg$/, loader: "file-loader" }
]
Upon running npm run build
, an error popped up in my terminal:
ERROR in ./src/app-client.js
Module not found: Error: Cannot resolve module 'style-loader' in /path/to/app/.../src
@ ./src/app-client.js 15:13-46
I'm puzzled by this issue and would appreciate any guidance or assistance on what might be causing it.