We have integrated webpack into our deployment process to bundle resources efficiently. However, we are now facing a challenge as we aim to include the bundling of sass files through webpack in order to streamline our build process. The MiniCssExtractPlugin is reporting an error stating that webpack_require is not defined.
The root cause of this issue seems to be connected to the code within css-loader.
We have attempted various solutions to troubleshoot this problem, such as experimenting with different package versions, reinstalling components, and verifying for any remnants of global packages. Unfortunately, none of these efforts have yielded a resolution yet.
We would appreciate any assistance or insights on how to resolve this matter.
Error Message:
ERROR in ./css/theme.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: __webpack_require__(...) is not a function
at Module.<anonymous> (****project/_dev/node_modules/css-loader/dist/cjs.js!****project/_dev/node_modules/sass-loader/dist/cjs.js??ref--5-2!****project/_dev/css/theme.scss:123:63)
... (Additional stack trace data here) ...
@ multi ./js/global.js ./css/theme.scss global[1]
webpack.config.js
const path = require('path');
const AssetsPlugin = require('assets-webpack-plugin');
... (Webpack configuration continues here) ...
Package.json
{
"dependencies": {
"@babel/core": "7.6.4",
... (List of dependencies shown in original text) ...
},
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "7.2.0",
... (List of devDependencies shown in original text) ...
}
}