webpack-babel-multi-target-plugin icon indicating copy to clipboard operation
webpack-babel-multi-target-plugin copied to clipboard

htmlWebpackPluginAlterAssetTags is undefined

Open eolme opened this issue 4 years ago • 8 comments

I can't figure out what's wrong, but I have an error:

htmlWebpackPluginAlterAssetTags is undefined

here:

compiler.hooks.compilation.tap(plugin_name_1.PLUGIN_NAME, (compilation) => {
    if (compilation.name) {
        return;
    }
    compilation.hooks.htmlWebpackPluginAlterAssetTags.tapPromise(`${plugin_name_1.PLUGIN_NAME} add safari nomodule fix tags`, (htmlPluginData) => __awaiter(this, void 0, void 0, function* () {
        const element = this.inject === babel_multi_target_options_1.SafariNoModuleFixInject.body ? htmlPluginData.body : htmlPluginData.head;
        element.unshift(this.createSafariNoModuleFixTag());
        return htmlPluginData;
    }));
});

Trace:

TypeError: Cannot read property 'tapPromise' of undefined
    at C:\Repo\org\test\node_modules\@mntm\scripts\node_modules\webpack-babel-multi-target-plugin\dist\src\safari-nomodule-fix\safari.nomodule.fix.plugin.js:107:63
    at SyncHook.eval [as call] (eval at create (C:\Repo\org\test\node_modules\@mntm\scripts\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:99:1)

eolme avatar Jan 10 '21 18:01 eolme

deps:

{
  "html-webpack-plugin": "^4.5.1",
  "webpack": "^4.45.0"
}

config:

{
  safari10NoModuleFix: {
    mode: 'inline',
    inject: 'head',
    minify: true
  }
}

eolme avatar Jan 10 '21 19:01 eolme

Well, this is due to html-webpack-plugin v4 changed the way of calling hooks. It's likely to be fixed in #86

Austaras avatar Jan 11 '21 07:01 Austaras

What version is currently compatible?

eolme avatar Jan 11 '21 08:01 eolme

html-webpack-plugin v3

Austaras avatar Jan 11 '21 08:01 Austaras

Thanks

eolme avatar Jan 11 '21 09:01 eolme

@Austaras html-webpack-plugin@^4.0.0 should be supported as of 2.5.0 via #55

@eolme if this is breaking on [email protected] and html-webpack-plugin@^4.0.0, then it's a bug and this should be open.

DanielSchaffer avatar Jan 12 '21 17:01 DanielSchaffer

@DanielSchaffer yes this should be open. The bug is simple: safari fix plugin isn't updated in #55

Austaras avatar Jan 12 '21 17:01 Austaras

Are there any updates on this?

Leeingnyo avatar May 18 '22 05:05 Leeingnyo