I'm using react, my project was running just fine, then out of nowhere i got this error with all the sass file
Module build failed (from ./node_modules/style-loader/dist/cjs.js):
ValidationError: Invalid options object. Style Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'sourceMap'. These properties are valid:
object { injectType?, attributes?, insert?, base?, esModule?, styleTagTransform? }
at validate (D:\projects\react\template2\node_modules\schema-utils\dist\validate.js:191:11)
at Object.getOptions (D:\projects\react\template2\node_modules\webpack\lib\NormalModule.js:591:19)
at Object.pitch (D:\projects\react\template2\node_modules\style-loader\dist\index.js:22:24)
System:
OS: Windows 10 10.0.22000
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 5.85 GB / 15.85 GB
Binaries:
Node: 19.7.0 - C:\Program Files\nodejs\node.EXE
npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (116.0.1938.69)
Internet Explorer: 11.0.22000.120
Packages:
sass-loader: ^10.0.0 => 10.0.0
style-loader: ^3.3.3 => 3.3.3
webpack: ^5.88.2 => 5.88.2
webpack-cli: ^5.1.4 => 5.1.4
I tried uninstalling && re installing sass loader but it didn't work for me
Also, I tried changing const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; to = false;
and tried adding devtool: isEnvProduction ? 'source-map' to webpack