ERROR in TypeError: The 'compilation' argument must be an instance of Compilation
ERROR in TypeError: The 'compilation' argument must be an instance of Compilation
-
JavascriptModulesPlugin.js:118 getCompilationHooks [webpack_demo]/[webpack]/lib/javascript/JavascriptModulesPlugin.js:118:10
-
CommonJsChunkFormatPlugin.js:30 compiler.hooks.thisCompilation.tap.compilation [webpack_demo]/[webpack]/lib/javascript/CommonJsChunkFormatPlugin.js:30:19
-
Hook.js:14 Hook.CALL_DELEGATE [as _call] [npm]/[webpack]/[tapable]/lib/Hook.js:14:14
-
Compiler.js:915 Compiler.newCompilation [npm]/[webpack]/lib/Compiler.js:915:30
-
Compiler.js:957 hooks.beforeCompile.callAsync.err [npm]/[webpack]/lib/Compiler.js:957:29
-
Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync] [npm]/[webpack]/[tapable]/lib/Hook.js:18:14
-
Compiler.js:952 Compiler.compile [npm]/[webpack]/lib/Compiler.js:952:28
-
Compiler.js:477 Compiler.runAsChild [npm]/[webpack]/lib/Compiler.js:477:8
webpack 5.0.0 compiled with 1 error in 1586 ms
so? How to solve
const path = require('path') const HtmlWebpackPlugin = require('html-webpack-plugin') plugins: [ new HtmlWebpackPlugin({ template: path.resolve(__dirname, 'index.html'), }), ],
@tw19920521 this plugin is not fully compatible with Webpack 5 yet, see https://github.com/jantimon/html-webpack-plugin/issues/1527
See also this issue with discussion: https://github.com/jantimon/html-webpack-plugin/issues/1451
duplicate of #1451
Probably fixed in [email protected] please repoen this issue if it's not fixed.