Open HaMr123 opened 3 years ago
已经通过配置
chainWebpack: (config) => {
config.plugin('html-index')
.tap((args) => {
// console.info(args[0].template);
args[0].template = html-loader!webpack-html-include-loader!${args[0].template}
;
return args;
});
},
解决该问题
注意 html-loader版本尽量低,我成功使用的是"html-loader": "^0.5.5",
很遗憾出错了:
ERROR in Error: Child compilation failed:
Module not found: Error: Can't resolve '/""' in 'D:\JOYZL\sites\joyzl\src'
ModuleNotFoundError: Module not found: Error: Can't resolve '/""' in 'D:\JOYZL\sites\joyzl\src'
at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\Compilation.js:2094:28
at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\NormalModuleFactory.js:895:13
at eval (eval at create (D:\JOYZL\sites\joyzl\node_modules\tapable\lib\HookCodeFactory.js:33:10),
环境
"devDependencies": { "css-loader": "^7.1.1", "csv-loader": "^3.0.5", "html-loader": "^5.0.0", "html-webpack-plugin": "^5.6.0", "mini-css-extract-plugin": "^2.9.0", "style-loader": "^4.0.0", "webpack": "^5.91.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4", "webpack-html-include-loader": "^0.1.5" }
当我配置为 { entry: './src/pages/index/index.js', template: 'html-loader!webpack-html-include-loader!./src/pages/index/index.html', fileName: 'index.html', chunks: [ 'chunk-vendors', 'chunk-common', 'index' ], minify: false } 模版路径未能识别到