Open vitorcamachoo opened 2 years ago
Just if it helps. If I remove my service-worker.ts file then everything works as expected. (No matter the content inside service-worker.ts)
I needed it since we are using it in our webapp. Will keep investigating.
For me I had to explicitly add webpack@5
as a dependency. Storybook default hardcodes Webpack v4 and CRA allows v4 to be used as a dependency so it got hoisted (I'm using a lerna monorepo).
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#wrong-webpack-version
I think CRA should enforce Webpack 5+.
@dobrynin How did you manage to install webpack 5 successfully? Whenever I try to I get an error:
TypeError: The 'compilation' argument must be an instance of Compilation
It seems like it is because now I have two webpack versions installed, probably 4 and 5, so I'm not overriding it. How did you deal with that?
@marduzca unfortunately I did not run into that issue so I don't have any insight. For me the issue was solved after explicitly listing webpack v5 in my package.json.
In my case it was necessary to specify the service-worker file extension
@Nonsmokers where did you specify it exactly?
In case anyone is as clueless as I was until now, this might help you:
The problem is indeed that the storybook webpack version 4 differs from the default webpack 5 version from CRA 5.
There are a few different ways to fix this depending on your previous configuration, but one way to make it very painless is to use the storybook upgrade script that will notice the problem and will do the necessary fixes for you.
You only need to run:
npx sb@latest upgrade
Hope it helps someone!
@marduzca I tried your suggestion but still facing the same issue when running npm run start
.
/react-scripts/scripts/start.js:19
throw err;
^
TypeError: The 'compilation' argument must be an instance of Compilation
at Function.getCompilationHooks (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/webpack/lib/NormalModule.js:227:10)
at /Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/webpack-manifest-plugin/dist/index.js:58:42
at _next40 (eval at create (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:50:1)
at _next18 (eval at create (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1)
at Hook.eval [as call] (eval at create (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:137:1)
at Hook.CALL_DELEGATE [as _call] (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/webpack/lib/Compiler.js:1122:26)
at /Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/webpack/lib/Compiler.js:1166:29
at Hook.eval [as callAsync] (eval at create (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/vijay.krishna/Documents/quantilope/survey-frontend/node_modules/react-scripts/node_modules/tapable/lib/Hook.js:18:14)
Is anyone facing this issue or has face this issue and resolved it somehow?
what solved the issue for me was updating the webpack-cli
in my devDependencies
so basically:
-"webpack-cli": "3.3.8"
+"webpack-cli": "4.10.0"
Hi i'm using Azure pipeline to build a react app. I had the same issue and i confirm that adding "webpack": "^5.78.0" to the devDependencies resolved the issue. thanks to @dobrynin
Describe the bug
Cannot build the application on the latest version (5.0.0)
Did you try recovering your dependencies?
Yes.
Which terms did you search for in User Guide?
N/A
Environment
Steps to reproduce
Expected behavior
Should build the application with success.
Actual behavior