preload-webpack-plugin
preload-webpack-plugin copied to clipboard
tapAsync undefined in webpack4
Building with PreloadWebpackPlugin enabled causes following error:
/home/alex/GIT/proj/node_modules/preload-webpack-plugin/build/index.js:163
compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tapAsync(_this2.constructor.name, function (htmlPluginData, callback) {
^
TypeError: Cannot read property 'tapAsync' of undefined
at /home/alex/GIT/proj/node_modules/preload-webpack-plugin/build/index.js:163:67
Project package versions: [email protected] [email protected]
Can you try things out with the v3.0.0 alpha releases and let me know if you run into any issues there?
$ npm install --save-dev preload-webpack-plugin@next
I already use version 3.0.0-alpha.3
Which version of html-webpack-plugin are you using ?
3.2.0, wrote on top
Sorry for my mistake. I take a test on webpack v4.2.0 and html-webpack-plugin v3.2.0
It works well here.
I guess you may use preload-webpack-plugin before html-webpack-plugin. If you do that, the htmlWebpackPluginBeforeHtmlProcessing may missed because it has not been registered.
Can you make a check for this ? If not, can you provide us your webpack config ?
Thank you! With preload plugin after html-webpack-plugin it works good!
@toxic-johann,
I am having the same issue, what do you mean by using preload-webpack-plugin before html-webpack-plugin? how can I change the order of plugin to build?
Thank you
@mejiciel In the webpack plugins array. You should put html-webpack-plugin before preload-webpack-plugin.
FWIW, The v3 branch has a new check for this, and will display in a meaningful error message when this happens: https://github.com/GoogleChromeLabs/preload-webpack-plugin/commit/89f6495dcd0f4a17db85566ebd3357f4375a6bce#diff-1fdf421c05c1140f6d71444ea2b27638R123
This issue should remain opened until Webpack 4 support is released, just for better visibility.
in which file should I put html-webpack-plugin before preload-webpack-plugin ?
I am having same issue. using - "base-href-webpack-plugin": "^2.0.0", "html-webpack-plugin": "4.0.0-alpha.1",
I'm using webpack 4.42.1 and I had the same issue, using "base-href-webpack-plugin": "^2.0.0", "html-webpack-plugin": "4.0.1". But I fixed it installing "html-webpack-plugin": "^3.2.0", and "base-href-webpack-plugin": "^2.0.0".