verymuch / webpack-html-include-loader

A easy way to include one html file in anohter html file~!
8 stars 2 forks source link

有个关于 html-loader!webpack-html-include-loader!./src/pages/index/index.html #2

Open HaMr123 opened 3 years ago

HaMr123 commented 3 years ago

当我配置为 { 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 } 模版路径未能识别到

HaMr123 commented 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",

SimonZhangXi commented 5 months ago

很遗憾出错了: 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), :10:1 ) at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\NormalModuleFactory.js:332:22 at eval (eval at create (D:\JOYZL\sites\joyzl\node_modules\tapable\lib\HookCodeFactory.js:33:10), :9:1) at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\NormalModuleFactory.js:509:22 at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\NormalModuleFactory.js:151:11 at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\NormalModuleFactory.js:767:25 at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\NormalModuleFactory.js:979:8 at D:\JOYZL\sites\joyzl\node_modules\webpack\lib\NormalModuleFactory.js:1109:5

环境

"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" }