question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compiler.hooks.done is undefined

See original GitHub issue

Bug report

What is the current behavior? compiler.hooks.done is undefined. compiler.hooks.* are all undefined.

C:\projects\myProjectPath\node_modules\webpack-bundle-analyzer\lib\BundleAnalyzerPlugin.js:90
      compiler.hooks.done.tapAsync('webpack-bundle-analyzer', done);
                          ^

TypeError: Cannot read property 'tapAsync' of undefined
    at BundleAnalyzerPlugin.apply (C:\projects\myProjectPath\node_modules\webpack-bundle-analyzer\
lib\BundleAnalyzerPlugin.js:90:27)
    at C:\projects\myProjectPath\node_modules\enhanced-resolve\lib\ResolverFactory.js:314:10
    at Array.forEach (<anonymous>)
    at Object.exports.createResolver (C:\projects\myProjectPath\node_modules\enhanced-resolve\lib\
ResolverFactory.js:313:10)
    at ResolverFactory._create (C:\projects\myProjectPath\node_modules\webpack\lib\ResolverFactory
.js:57:28)
    at ResolverFactory.get (C:\projects\myProjectPath\node_modules\webpack\lib\ResolverFactory.js:
49:28)
    at NormalModuleFactory.getResolver (C:\projects\myProjectPath\node_modules\webpack\lib\NormalM
oduleFactory.js:521:31)
    at C:\projects\myProjectPath\node_modules\webpack\lib\NormalModuleFactory.js:165:32
    at C:\projects\myProjectPath\node_modules\webpack\lib\NormalModuleFactory.js:129:4
    at handleExternal (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlu
gin.js:28:34)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:103:26
    at next (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:65:
43)
    at handleExternals (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPl
ugin.js:71:7)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:101:5
    at handleExternal (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlu
gin.js:28:34)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:103:26
    at next (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:65:
43)
    at handleExternals (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPl
ugin.js:71:7)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:101:5
    at C:\projects\myProjectPath\node_modules\webpack\lib\NormalModuleFactory.js:400:5
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (C:\projects\myProjectPath\nod
e_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesWaterfallHook.lazyCompileHook (C:\projects\myProjectPath\node_modules\tapable\li
b\Hook.js:154:20)
    at NormalModuleFactory.create (C:\projects\myProjectPath\node_modules\webpack\lib\NormalModule
Factory.js:381:28)
    at C:\projects\myProjectPath\node_modules\webpack\lib\Compilation.js:1063:18
    at Semaphore.acquire (C:\projects\myProjectPath\node_modules\webpack\lib\util\Semaphore.js:29:
4)
    at Compilation._addModuleChain (C:\projects\myProjectPath\node_modules\webpack\lib\Compilation
.js:1062:18)
    at Compilation.addEntry (C:\projects\myProjectPath\node_modules\webpack\lib\Compilation.js:116
4:8)
    at C:\projects\myProjectPath\node_modules\webpack\lib\SingleEntryPlugin.js:46:17
    at AsyncParallelHook.eval [as callAsync] (eval at create (C:\projects\myProjectPath\node_modul
es\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncParallelHook.lazyCompileHook (C:\projects\myProjectPath\node_modules\tapable\lib\Hook.
js:154:20)
    at C:\projects\myProjectPath\node_modules\webpack\lib\Compiler.js:669:20
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\projects\myProjectPath\node_modules
\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (C:\projects\myProjectPath\node_modules\tapable\lib\Hook.js
:154:20)
    at Compiler.compile (C:\projects\myProjectPath\node_modules\webpack\lib\Compiler.js:662:28)
    at C:\projects\myProjectPath\node_modules\webpack\lib\Compiler.js:321:11
    at Compiler.readRecords (C:\projects\myProjectPath\node_modules\webpack\lib\Compiler.js:529:11
)
T60273:[/c/projects/myProject]$ webpack
C:\projects\myProjectPath\node_modules\webpack-bundle-analyzer\lib\BundleAnalyzerPlugin.js:90
      compiler.hooks.done.tapAsync('webpack-bundle-analyzer', done);
                          ^

TypeError: Cannot read property 'tapAsync' of undefined
    at BundleAnalyzerPlugin.apply (C:\projects\myProjectPath\node_modules\webpack-bundle-analyzer\
lib\BundleAnalyzerPlugin.js:90:27)
    at C:\projects\myProjectPath\node_modules\enhanced-resolve\lib\ResolverFactory.js:314:10
    at Array.forEach (<anonymous>)
    at Object.exports.createResolver (C:\projects\myProjectPath\node_modules\enhanced-resolve\lib\
ResolverFactory.js:313:10)
    at ResolverFactory._create (C:\projects\myProjectPath\node_modules\webpack\lib\ResolverFactory
.js:57:28)
    at ResolverFactory.get (C:\projects\myProjectPath\node_modules\webpack\lib\ResolverFactory.js:
49:28)
    at NormalModuleFactory.getResolver (C:\projects\myProjectPath\node_modules\webpack\lib\NormalM
oduleFactory.js:521:31)
    at C:\projects\myProjectPath\node_modules\webpack\lib\NormalModuleFactory.js:165:32
    at C:\projects\myProjectPath\node_modules\webpack\lib\NormalModuleFactory.js:129:4
    at handleExternal (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlu
gin.js:28:34)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:103:26
    at next (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:65:
43)
    at handleExternals (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPl
ugin.js:71:7)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:101:5
    at handleExternal (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlu
gin.js:28:34)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:103:26
    at next (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:65:
43)
    at handleExternals (C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPl
ugin.js:71:7)
    at C:\projects\myProjectPath\node_modules\webpack\lib\ExternalModuleFactoryPlugin.js:101:5
    at C:\projects\myProjectPath\node_modules\webpack\lib\NormalModuleFactory.js:400:5
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (C:\projects\myProjectPath\nod
e_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesWaterfallHook.lazyCompileHook (C:\projects\myProjectPath\node_modules\tapable\li
b\Hook.js:154:20)
    at NormalModuleFactory.create (C:\projects\myProjectPath\node_modules\webpack\lib\NormalModule
Factory.js:381:28)
    at C:\projects\myProjectPath\node_modules\webpack\lib\Compilation.js:1063:18
    at Semaphore.acquire (C:\projects\myProjectPath\node_modules\webpack\lib\util\Semaphore.js:29:
4)
    at Compilation._addModuleChain (C:\projects\myProjectPath\node_modules\webpack\lib\Compilation
.js:1062:18)
    at Compilation.addEntry (C:\projects\myProjectPath\node_modules\webpack\lib\Compilation.js:116
4:8)
    at C:\projects\myProjectPath\node_modules\webpack\lib\SingleEntryPlugin.js:46:17
    at AsyncParallelHook.eval [as callAsync] (eval at create (C:\projects\myProjectPath\node_modul
es\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncParallelHook.lazyCompileHook (C:\projects\myProjectPath\node_modules\tapable\lib\Hook.
js:154:20)
    at C:\projects\myProjectPath\node_modules\webpack\lib\Compiler.js:669:20
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\projects\myProjectPath\node_modules
\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (C:\projects\myProjectPath    at C:\projects\myProjectPath\node_modules\webpack\lib\Compi
ler.js:669:20
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\project
s\myProjectPath\node_modules\tapable\lib\HookCodeFactory.js:33:
10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (C:\projects\myProjectPath
er\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.compile (C:\projects\myProjectPath\node_modules
\webpack\lib\Compiler.js:662:28)
    at C:\projects\myProjectPath\node_modules\webpack\lib\Compi
ler.js:321:11
    at Compiler.readRecords (C:\projects\myProjectPath\node_mod
ules\webpack\lib\Compiler.js:529:11)

If the current behavior is a bug, please provide the steps to reproduce. https://github.com/valscion/webpack-bundle-analyzer-issue-333

What is the expected behavior? compiler.hooks.done.tapAsync should exist on compiler.hooks

Other relevant information: webpack version: 4.41.6 Node.js version: 12.12.28 Operating System: Same behavior macOS Catalina and Windows 10 Additional tools:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sokracommented, Feb 26, 2020

Duplicate of webpack-contrib/webpack-bundle-analyzer#333

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiler Hooks | webpack
Executed when the compilation has completed. This hook is not copied to child compilers. Callback Parameters: stats. additionalPass. AsyncSeriesHook.
Read more >
Will the `hooks.invalid` be called when sth invalid?
the docs of webpack said hooks.invalid will be Executed when a watching compilation has been invalidated. https://webpack.js.org/api/compiler- ...
Read more >
webpack/webpack - Gitter
Hello guys, I setup a react webpack project + typescript. But after the compilation, I have a Cannot read Component of undefined ....
Read more >
3.12 Program Instrumentation Options
The -fsanitize-trap= option instructs the compiler to report for sanitizers mentioned in comma-separated list of opts undefined behavior using __builtin_trap ...
Read more >
@types/event-hooks-webpack-plugin | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found