Skip to content

Webpack v5 Upgrade - build-storybook fails #14130

@marjisound

Description

@marjisound

Describe the bug
Hi, we are trying to upgrade our project to webpack 5. But build-storybook fails with the following error:

			throw new TypeError(
			^

TypeError: The 'compilation' argument must be an instance of Compilation
    at Function.getCompilationHooks (/Users/marjank/code/apps-rendering/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js:112:10)
    at /Users/marjank/code/apps-rendering/node_modules/terser-webpack-plugin/dist/index.js:571:67
    at SyncHook.eval [as call] (eval at create (/Users/marjank/code/apps-rendering/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:85:1)
    at SyncHook.lazyCompileHook (/Users/marjank/code/apps-rendering/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/Users/marjank/code/apps-rendering/node_modules/@storybook/core/node_modules/webpack/lib/Compiler.js:631:26)
    at /Users/marjank/code/apps-rendering/node_modules/@storybook/core/node_modules/webpack/lib/Compiler.js:667:29
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/marjank/code/apps-rendering/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/marjank/code/apps-rendering/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/Users/marjank/code/apps-rendering/node_modules/@storybook/core/node_modules/webpack/lib/Compiler.js:662:28)
    at /Users/marjank/code/apps-rendering/node_modules/@storybook/core/node_modules/webpack/lib/Compiler.js:321:11
    at Array.<anonymous> (/Users/marjank/code/apps-rendering/node_modules/@storybook/core/node_modules/webpack/lib/Compiler.js:534:20)
    at Storage.finished (/Users/marjank/code/apps-rendering/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Users/marjank/code/apps-rendering/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at callback (/Users/marjank/code/apps-rendering/node_modules/graceful-fs/polyfills.js:295:20)
    at FSReqCallback.oncomplete (fs.js:168:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Could you please guide me on what things I can try. I went through all the comments and updates in #9216
I also tried different alpha versions including #13808

To Reproduce
Upgrade Webpack
Upgraded storybook to the latest version
Running build-storybook fails (But start-storybook works fine!!)

System
"@storybook/addon-essentials": "^6.1.21",
"@storybook/addon-knobs": "^6.1.21",
"@storybook/addon-storyshots": "^6.1.21",
"@storybook/react": "^6.1.21",
"@storybook/storybook-deployer": "^2.8.7"

Node:: v12.20.0
NPM: 6.14.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions