I've updated my project to create-react-app v2 ("react-scripts": "^2.0.3").
Running start-storybook -p 9001 -c .storybook or build-storybook -c .storybook -o build/storybook will fail with the error:
> start-storybook -p 9001 -c .storybook
info @storybook/react v3.4.11
info
info => Loading custom addons config.
info => Using default webpack setup based on "Create React App".
f:\www\console-lite\node_modules\webpack\lib\DefinePlugin.js:93
compiler.hooks.compilation.tap(
^
TypeError: Cannot read property 'compilation' of undefined
at DefinePlugin.apply (f:\www\console-lite\node_modules\webpack\lib\DefinePlugin.js:93:18)
at Compiler.apply (f:\www\console-lite\node_modules\@storybook\core\node_modules\tapable\lib\Tapable.js:375:16)
at webpack (f:\www\console-lite\node_modules\@storybook\core\node_modules\webpack\lib\webpack.js:33:19)
at exports.default (f:\www\console-lite\node_modules\@storybook\core\dist\server\middleware.js:29:40)
at buildDev (f:\www\console-lite\node_modules\@storybook\core\dist\server\build-dev.js:163:36)
at Object.<anonymous> (f:\www\console-lite\node_modules\@storybook\react\dist\server\index.js:23:22)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (f:\www\console-lite\node_modules\@storybook\react\bin\index.js:3:1)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
See React blog to see how to update to CRA V2: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html.
Switching back to 1.1.5 will work!
create-react-app v2 uses webpack 4, and a compatible version of SB that uses webpack 4 is latest v4.alpha.
Thanks @igor-dv, so the only way to use CRA v2 and Storybook is to migrate Storybook to v4.alpha.
Yes. Why is it a problem ?
There is no problem ^^ I was unaware of v4 and I was not expecting v3 to break because of CRA migration to webpack 4. If there are others people in my situation, here is the doc: https://github.com/storybooks/storybook/blob/master/MIGRATION.md#from-version-34x-to-40x
How can I update to v4 RC1 ? what command should I run.
npx [email protected]
Doesn't work for me: notarget No matching version found for [email protected]
@yairEO Run npx -p @storybook/cli@rc sb init
Most helpful comment
There is no problem ^^ I was unaware of v4 and I was not expecting v3 to break because of CRA migration to webpack 4. If there are others people in my situation, here is the doc: https://github.com/storybooks/storybook/blob/master/MIGRATION.md#from-version-34x-to-40x