-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'tapAsync' of undefined #44
Comments
Hi, Also does it work before ejection? |
yes it worked before ejection, it was default CRA gist with package.json and webpack config https://gist.github.com/nim-f/69a2d0ffd6cbb05ff8bc9ba197455c44 full error:
|
Any news? |
Getting the same error, also with ejected CRA. Very similar to the config nim-f posted |
I had same kind of problem with another plugin, then replaced compilation.hooks.htmlWebpackPluginAlterAssetTags.tap with HtmlWebpackPlugin.getHooks(e).alterAssetTags.tap and it worked. Seems api of HtmlWebpackPlugin changed and plugins need to be updated as well |
Workaround might be to use an older version of HtmlWebpackPlugin then. Will try tomorrow and report back (if I remember) |
Could not downgrade HtmlWebpackPlugin due to dependencies. Though looking at the source and changing stuff I encountered this
Which happened when I changed: -if (compilation.hooks) {
+if (compilation.hooks && compilation.hooks[event]) {
debug('MikeE', event);
debug('MikeE', compilation.hooks);
compilation.hooks[event].tapAsync('StyleExtHtmlWebpackPlugin', wrappedFn);
} else {
compilation.plugin(event, wrappedFn);
} Though I've yet to figure out anything further |
Tried changing it around // HtmlWebpackPlugin 4.x and later
const htmlWebpackHookEvents = {
htmlWebpackPluginBeforeHtmlProcessing: 'beforeAssetTagGeneration',
htmlWebpackPluginAlterAssetTags: 'alterAssetTags',
htmlWebpackPluginAfterHtmlProcessing: 'afterTemplateExecution'
}
//...
if (compilation.hooks) {
debug('MikeE', event);
debug('MikeE', compilation.hooks);
if (compilation.hooks[event]) {
compilation.hooks[event].tapAsync('StyleExtHtmlWebpackPlugin', wrappedFn);
}
else {
// deals with HtmlWebpackPlugin 4
var HtmlWebpackPlugin = require('html-webpack-plugin');
var hooks = HtmlWebpackPlugin.getHooks(compilation);
hooks[htmlWebpackHookEvents[event]].tapAsync('StyleExtHtmlWebpackPlugin', wrappedFn);
}
} Yet now I'm encountering
And although that TypeError is not part of this library, I'm not sure if it is causing the issue |
The code above does work, tried it without MiniCssExtractPlugin and it encountered no issues. Though I'm getting the TypeError issue together with MiniCssExtractPlugin (formerly ExtractTextWebpackPlugin). I'm unsure as to why |
Hi - working on this. |
That was easier than expected. |
Looks like the issue is still exist :( I just copy paste the example code into my webpack config file, latest version installed from this plugin and when I run, I get tapAsync issue again. Anybody can help me please? |
I am facing this issue too, any updates? beforeGenerationHook.tapPromise('AddAssetHtmlPlugin', htmlPluginData =>
^
TypeError: Cannot read property 'tapPromise' of undefined
at compiler.hooks.compilation.tap.compilation (/JEY/node_modules/add-asset-html-webpack-plugin/lib/index.js:119:28)
at SyncHook.eval [as call] (eval at create (/JEY/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:15:1)
at SyncHook.lazyCompileHook (/JEY/node_modules/tapable/lib/Hook.js:154:20)
at Compiler.newCompilation (/JEY/node_modules/webpack/lib/Compiler.js:631:26)
at hooks.beforeCompile.callAsync.err (/JEY/node_modules/webpack/lib/Compiler.js:667:29) |
The only solution I found was to downgrade to 3.2.0 The same here: /Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/html-beautify-webpack-plugin/index.js:46
compilation.hooks.htmlWebpackPluginAfterHtmlProcessing.tapAsync('HtmlBeautifyPlugin', (htmlPluginData, callback) => {
^
TypeError: Cannot read property 'tapAsync' of undefined
at /Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/html-beautify-webpack-plugin/index.js:46:68
at SyncHook.eval [as call] (eval at create (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:9:1)
at SyncHook.lazyCompileHook (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/tapable/lib/Hook.js:154:20)
at Compiler.newCompilation (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/webpack/lib/Compiler.js:631:26)
at /Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/webpack/lib/Compiler.js:667:29
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/tapable/lib/Hook.js:154:20)
at Compiler.compile (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/webpack/lib/Compiler.js:662:28)
at /Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/webpack/lib/Watching.js:77:18
at _next0 (eval at create (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
at eval (eval at create (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
at LiveReloadPlugin.serverStarted (/Volumes/DevLocal/DevTypeScript/Production/mobiad/auth/node_modules/webpack-livereload-plugin/index.js:89:9)
at Object.onceWrapper (events.js:420:28)
at Server.emit (events.js:314:20)
at emitListeningNT (net.js:1350:10)
at processTicksAndRejections (internal/process/task_queues.js:79:21) |
Plugin doesn't work with ejected create-react-app, webpack version is 4.29.6
The text was updated successfully, but these errors were encountered: