html-webpack-plugin icon indicating copy to clipboard operation
html-webpack-plugin copied to clipboard

ERROR in TypeError: The 'compilation' argument must be an instance of Compilation

Open tw19920521 opened this issue 6 years ago • 6 comments

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

tw19920521 avatar Oct 20 '20 07:10 tw19920521

so? How to solve

tw19920521 avatar Oct 20 '20 07:10 tw19920521

const path = require('path') const HtmlWebpackPlugin = require('html-webpack-plugin') plugins: [ new HtmlWebpackPlugin({ template: path.resolve(__dirname, 'index.html'), }), ],

tw19920521 avatar Oct 20 '20 07:10 tw19920521

@tw19920521 this plugin is not fully compatible with Webpack 5 yet, see https://github.com/jantimon/html-webpack-plugin/issues/1527

csvan avatar Oct 21 '20 10:10 csvan

See also this issue with discussion: https://github.com/jantimon/html-webpack-plugin/issues/1451

Shakeskeyboarde avatar Oct 21 '20 15:10 Shakeskeyboarde

duplicate of #1451

jantimon avatar Oct 22 '20 08:10 jantimon

Probably fixed in [email protected] please repoen this issue if it's not fixed.

jantimon avatar Nov 01 '20 12:11 jantimon