resolve-url-loader
resolve-url-loader copied to clipboard
[V4] webpack5 sets devtool to false, and an error is reported
ERROR in ./resources/assets/pages/auth/lottery/lottery.css Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/resolve-url-loader/index.js): Error: resolve-url-loader: error processing CSS a valid source-map is not present (ensure preceding loaders output a source-map) at file://E:\code\m-soa\resources\assets\pages\auth\lottery\lottery.css:1:57 at encodeError (E:\code\m-soa\node_modules\resolve-url-loader\index.js:274:12) at onFailure (E:\code\m-soa\node_modules\resolve-url-loader\index.js:215:14) at processResult (E:\code\m-soa\node_modules\webpack\lib\NormalModule.js:703:19) at E:\code\m-soa\node_modules\webpack\lib\NormalModule.js:809:5 at E:\code\m-soa\node_modules\loader-runner\lib\LoaderRunner.js:399:11 at E:\code\m-soa\node_modules\loader-runner\lib\LoaderRunner.js:251:18 at context.callback (E:\code\m-soa\node_modules\loader-runner\lib\LoaderRunner.js:124:13) at onFailure (E:\code\m-soa\node_modules\resolve-url-loader\index.js:215:5)
Firstly check you have {sourceMap: true}
from sass-loader
as shown here. I know this may be obvious but it's often overlooked.
Assuming that is not the problem, please provide a minimum breaking example as an OSS repo.
Came here to say I was seeing the same thing. Setting devtool
to 'source-map'
made resolve-url-loader
work, and setting devtool
to false
gave that error message about source maps.
But @bholloway was correct. It's the sourceMap
option that's important.
We have a pretty complex setup with postcss-loader, sass-loader and css-loader used in different combination for different scenarios. I had just forgotten to set sourceMap: true
on one of the postcss-loader configs 🙂