HTML failing to compile. Error seems to take place with extract-loader. Appears to be a conflict regarding where main-bundle.js is generated and where extract loader is expecting to find main-bundle.js (?)
require('./main.css')
require('./index.html')
const path = require('path') module.exports = { entry: { main: "./src/main.js", }, mode: "development", output: { filename: "[name]-bundle.js", path: path.resolve(__dirname, "../dist"), publicPath: "/", }, devServer: { static: "dist", }, module: { rules: [ { test: /\.css$/i, use: [ { loader: 'style-loader', }, { loader: 'css-loader', } ] }, { test: /\.html$/i, use: [ { loader: 'file-loader', options: { name: '[name].html', } }, { loader: 'extract-loader', }, { loader: 'html-loader', options: { esModule: false, } }, ] } ] } };
"css-loader": "^6.7.1", "extract-loader": "^5.1.0", "file-loader": "^6.2.0", "html-loader": "^4.2.0", "style-loader": "^3.3.1", "webpack": "^5.74.0", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.11.1"
"webpack": "^5.74.0", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.11.1"
The extract-loader, 2nd in the chain of HTML compilation is throwing an error.
Error: Cannot find module './main-bundle.js' from
'C:...path\home\src'
Successful compilation
Browser: Chrome Operating System: Windows_NT, Windows 10 Home 10.0.19044 Node Js: 16.17.0 NPM: 8.19.2
I am using common js syntax, which may not be being read by the extract-loader.
The answer appears to be due to the extract-loader package being unmaintained. This answer covers the issue
Essentially the package is not maintained.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.