๋ฒ๊ทธ ์ค๋ช
core-js
์ ๋ฒ์ 3์ผ๋ก ์
๊ทธ๋ ์ด๋ ํ ํ ์คํ ๋ฆฌ ๋ถ์ด ์ปดํ์ผ๋์ง ์์ต๋๋ค.
์ด๊ฒ์ ์ฌ๋ณผ ํด๋ฆฌ ํ์ด ํ์ํ ๊ฒ๊ณผ ๊ด๋ จ์ด์์ ์ ์์ต๋๋ค.
https://github.com/storybooks/storybook/blob/0bdb2ca94e5ec732d84d3b330aa3b5bedfc534ec/lib/core/src/server/common/polyfills.js#L3
์ฌํํ๋ ค๋ฉด
๋์์ ์ฌํํ๋ ๋จ๊ณ :
core-js
๋ฒ์ 3.0 ์ด์ ์ค์นcorejs: { version: 3 },
์์ @babel/env
์ต์
ERROR in ./.storybook/config.js
Module not found: Error: Can't resolve 'core-js/modules/web.dom-collections.iterator' in '/Users/Work/react/.storybook'
@ ./.storybook/config.js 3:0-55
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js (webpack)-hot-middleware/client.js?reload=true
์ฒด๊ณ:
Storybook์ ์ด๋ป๊ฒ ๋ ์๋ชป core-js๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. @babel/preset-env
๋ฒ์ 7.4.1์ด core-js@3
์
๊ทธ๋ ์ด๋๋์๊ณ ํ
์คํธ๋ฅผ ์คํํ ๋ ๋ด Storybook ๋ฐ์ ์ฑ์ด ์์๋์์ต๋๋ค.
client-api๋ ์์ฑ ๋ ์ฝ์ด์ ํ์ํ๋ฏ๋ก ์ข ์์ฑ์ผ๋ก core-js @ 2 ๊ฐ ์์ด์ผํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค.
5.0.4 ๋ฐ 5.0.5๋ก ์์ ๋์๋ค๊ณ ๋งํ์ง๋ง ์ฌ์ ํ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
์ฌ์์ฐ ๋ฐฉ๋ฒ :
@storybook/cli
๋ฐ init ํจํค์ง๋ฅผ ์ค์นํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ npx -p @storybook/cli sb init --type react
์คํ ๋ฆฌ ๋ถ์ ์ด๊ธฐํํฉ๋๋ค.
โ my-prj npx -p @storybook/cli sb init --type react
npx: installed 404 in 11.526s
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
npm install --save core-js<strong i="11">@2</strong> npm install --save core-js<strong i="12">@3</strong>
yarn add core-js<strong i="13">@2</strong> yarn add core-js<strong i="14">@3</strong>
[BABEL] Note: The code generator has deoptimised the styling of /Users/lumio/.npm/_npx/74147/lib/node_modules/@storybook/cli/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
sb init - the simplest way to add a storybook to your project.
โข Installing Storybook for user specified project type. โ
โข Adding storybook support to your "React" app. โ
โข Preparing to install dependencies. โ
> [email protected] install ./my-prj/node_modules/fsevents
> node install
node-pre-gyp WARN Using needle for node-pre-gyp https download
[fsevents] Success: "./my-prj/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
added 1160 packages from 900 contributors in 23.386s
โข Installing dependencies. โ
To run your storybook, type:
npm run storybook
For more information visit: https://storybook.js.org
โ my-prj nvim .
โ my-prj yarn storybook
yarn run v1.15.2
$ start-storybook -p 6006
info @storybook/react v5.0.5
info
info => Loading presets
info => Loading presets
info => Loading custom addons config.
info => Using default webpack setup.
info => Using base config because react-scripts is not installed.
10% building 5/8 modules 3 active ...j/node_modules/querystring-es3/index.js
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
npm install --save core-js<strong i="15">@2</strong> npm install --save core-js<strong i="16">@3</strong>
yarn add core-js<strong i="17">@2</strong> yarn add core-js<strong i="18">@3</strong>
11% building 13/18 modules 5 active ...my-prj/node_modules/strip-ansi/index.js
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
npm install --save core-js<strong i="19">@2</strong> npm install --save core-js<strong i="20">@3</strong>
yarn add core-js<strong i="21">@2</strong> yarn add core-js<strong i="22">@3</strong>
webpack built 896edc3c5271d2618768 in 4031ms
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ Storybook 5.0.5 started โ
โ 4.71 s for manager and 4.48 s for preview โ
โ โ
โ Local: http://localhost:6006/ โ
โ On your network: http://10.52.40.112:6006/ โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
@lumio ์ค๋ฅ๊ฐ ์๋๋ผ ๊ฒฝ๊ณ ์
๋๋ค. 5.1.0-alpha.16
์์ ์์ ๋์์ผ๋ฉฐ, ์๋ฌด๋ ๋ถ๋ง์ ์ ๊ธฐํ์ง ์์ผ๋ฉด ๋ฉฐ์น ๋์ ๋ฐฐํฌ ๋ ํ latest
์์ ์ ๋ฆด๋ฆฌ์ค ํ ๊ฒ์
๋๋ค.
์์๋ค! ๊ฐ์ฌ!
์คํ ๋ฆฌ ๋ถ ๋ฒ์ ์ 5.0.6์ผ๋ก ์ ๊ทธ๋ ์ด๋ํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
@ jessy1092 ์ ๋ค๋ ค์. ์ง๊ธ์ ๋ซ๊ฒ ์ต๋๋ค. ์ด ๋ฌธ์ ๊ฐ ๋ค์ ๋ฐ์ํ๋ฉด ๋ค์ ์ด๊ฒ ์ต๋๋ค.
์๋
ํ์ธ์,
์คํ ๋ฆฌ ๋ถ 5.1.0-alpha.18์์๋ ์๋ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ฌํ ๊ฐ๋ฅํ ์ ์ฅ์ : https://github.com/christophehurpeau/cra-rest-hooks-storybook
yarn install
yarn storybook
์ด๊ฒ ๋์์ด ๋๊ธธ ๋ฐ๋๋ค
@christophehurpeau ์ ๋ฅผ ์ํด 5.0.6
์ฌ์ฉํด ์ฃผ์๊ฒ ์ต๋๊น? ๋ค์ ์ฌ๋ ์ค์
๋๋ค. ๐ญ
์ฃผ ํ๋ก์ ํธ์์ core-js @ v3 ์ ์ฌ์ฉํ๋ ๋์ ์ฌ์ ํ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ํด๊ฒฐ์ฑ
์ webpack ๊ตฌ์ฑ์์ core-js/modules
๊ฐ ์คํ ๋ฆฌ ๋ถ๊ณผ ํจ๊ป ๋ฒ๋ค๋ก ์ ๊ณต๋๋ ๋ฒ์ ์ผ๋ก ํ์ธ๋์๋์ง ํ์ธํ๋ ๊ฒ์ด ์์ต๋๋ค.
resolve: {
alias: {
'core-js/modules': path.resolve(
__dirname,
'node_modules/@storybook/core/node_modules/core-js/modules',
),
}
}
Hacky ์๋ฃจ์ ์ด์ง๋ง ์ง๊ธ์ ์ถฉ๋ถํฉ๋๋ค.
@shilman ๋ 5.0.6, ๋์ผํ ๊ฒฐ๊ณผ๋ฅผ ์๋ํ์ต๋๋ค (https://github.com/christophehurpeau/cra-rest-hooks-storybook/tree/storybook-5.0.6)
@artursvonda ๋๋ core-js v3๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ์ข
์์ฑ์ด ๊ทธ๊ฒ์ ์ฌ์ฉํฉ๋๋ค. v2๋ node_modules์์ ์ค๋ณต ์ ๊ฑฐ ๋ react-scripts์ @ storybook / core์์ ๋ชจ๋ ์ฌ์ฉ๋๊ธฐ ๋๋ฌธ์ node_modules/@storybook/core/node_modules/core-js
๊ฐ ์์ต๋๋ค. core-js 3์ ์ฌ์ฉํ๋ ์ข
์์ฑ ๋ง core-js๋ฅผ ์ฐพ์ง ๋ชปํฉ๋๋ค.
์ ๊ทธ๋์ ๋ณ์นญ์ ์ญ์ ํ๋ฉด ์๋ํฉ๋๋ค.
module.exports = ({ config, mode }) => {
console.log(config.resolve.alias);
delete config.resolve.alias['core-js'];
return config;
};
์. ๋ณ์นญ์ ๋ฌด์ญ์ต๋๋ค. ์ ๋ํ์ฑ ์์ ๊ทธ๊ฒ๋ค์ ์ฌ์ฉํฉ๋๊น?
cc @ndelangen
๋๋์ด ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์ต๊ทผ core-js @ 3 ์ ์ข
์์ฑ์ ์ถ๊ฐ ํ ์ต์ firebase๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
firebase๋ฅผ ์
๊ทธ๋ ์ด๋ ํ ํ ์คํํ๋ ๋ฐ ์ฌ์ฉ ๋ ์คํ ๋ฆฌ ๋ถ์์ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
ERROR in ./node_modules/@firebase/polyfill/dist/index.esm.js
Module not found: Error: Can't resolve 'core-js/features/array/find' in '/Users/jin/kinyapp/node_modules/@firebase/polyfill/dist'
@ ./node_modules/@firebase/polyfill/dist/index.esm.js 3:0-37
@ ./node_modules/firebase/app/dist/index.cjs.js
@ ./src/firebase.js
@ ./src/components/Login.js
@ ./src/stories/index.js
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@firebase/polyfill/dist/index.esm.js
Module not found: Error: Can't resolve 'core-js/features/array/find-index' in '/Users/jin/kinyapp/node_modules/@firebase/polyfill/dist'
@ ./node_modules/@firebase/polyfill/dist/index.esm.js 4:0-43
@ ./node_modules/firebase/app/dist/index.cjs.js
@ ./src/firebase.js
@ ./src/components/Login.js
@ ./src/stories/index.js
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@firebase/polyfill/dist/index.esm.js
Module not found: Error: Can't resolve 'core-js/features/object/assign' in '/Users/jin/kinyapp/node_modules/@firebase/polyfill/dist'
@ ./node_modules/@firebase/polyfill/dist/index.esm.js 5:0-40
@ ./node_modules/firebase/app/dist/index.cjs.js
@ ./src/firebase.js
@ ./src/components/Login.js
@ ./src/stories/index.js
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
ํ์ธํ ์ ์์ต๋๋ค.
// In some story or dependency of a story
import firebase from "firebase/app"
์๋ก์ด cra2
๋ฐ sb init
์ถฉ๋
๋์๊ฒ๋ ๊ฐ์ ๋ฌธ์ ์
๋๋ค. firebase
๋ฒ์ 4.12.1
๋์๊ฐ๋ ๊ฒ์ ํจ๊ณผ๊ฐ ์์์ง๋ง
์ ๊ทธ๋์ ๋ณ์นญ์ ์ญ์ ํ๋ฉด ์๋ํฉ๋๋ค.
module.exports = ({ config, mode }) => { console.log(config.resolve.alias); delete config.resolve.alias['core-js']; return config; };
๋ํ [email protected]
๋ฅผ [email protected]
์ ํจ๊ป ์ฌ์ฉํ๊ณ ์ด๋ฅผ .storybook/webpack.config.js
์ถ๊ฐํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋ฐฉ๊ธ firebase๊ฐ 5.10.0
๋ก ์
๋ฐ์ดํธ๋๊ณ ์คํ ๋ฆฌ ๋ถ๋ 5.0.10
์
๊ทธ๋ ์ด๋ ๋ ๊ฒ์ ๋ณด์๊ณ ์์ "hack"๋ณ์นญ์ ์ ๊ฑฐ ํ ์์์์ต๋๋ค.
๋ถํํ๋ firebase์ storybook์ ๋ชจ๋ ์ต์ ์ผ๋ก ์
๋ฐ์ดํธํด๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์์ต๋๋ค.
์ด ๋ฌธ์ ์ ๋ํด์๋ ๋ํ์ฑ
์ฌ์ฉ์ ์ค๋จํด์ผํฉ๋๋ค.
@zjaml ์์ @parkerholladay ์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์๋
@shilman ์ ๋ํด, ์ด๋ค ํ์ผ์์ ํด์ผํ ์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
@zjaml .storybook/webpack.config.js
์
๋๋ค. ๊ทธ๊ฒ์ด ๋น์ ์ ์ํด ์๋ํ๋์ง ์๋ ค์ฃผ์ญ์์ค!
@shilman ๊ทธ๋ ๊ฒ ์๋ํฉ๋๋ค! ๊ฐ์ฌ!
๋๋ babel preset-env๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฉฐ ์คํ ๋ฆฌ ๋ถ 5.0.10์์ ๋์ผํ ๋ฌธ์ ์ ์ง๋ฉดํ์ต๋๋ค.
"useBuiltIns": "usage",
"corejs": {version: 3},
๋ณ์นญ ์ญ์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ผ๋ก ํด๊ฒฐ ๋์์ต๋๋ค. ๐ @christophehurpeau
๋ฏธ๋ฆฌ๋ณด๊ธฐ์ webpack.config์์ ๋ณ์นญ์ ์ญ์ ํด์ผํฉ๋๊น?
์ด์ฉ๋ฉด ๋ชจ๋ ๋ณ์นญ์ผ๊น์?
์ฌ๊ธฐ์์ ๊ฐ์ ๋ฌธ์ , ๋ณ์นญ ์ ๊ฑฐ๋ ๋๋ฅผ ์ํด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ง ์์ต๋๋ค.
๋์๊ฒ๋ ๊ฐ์ ๋ฌธ์ ์ ๋๋ค. ๋ณ์นญ์ ์ ๊ฑฐํด๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์ต๋๋ค.
์ด PR์์ด ๋ฌธ์ ์ ๋ด๊ฐ ์๊ฐํ๋ ๋ค๋ฅธ ๋ง์ ๋ฌธ์ ๋ฅผ ๋ค๋ฃฐ ๊ฒ์
๋๋ค.
https://github.com/storybooks/storybook/pull/6566
๊ทธ๋๋ ์๋ง๋ ์ฃผ์ ๋ณ๊ฒฝ ์ฌํญ ์ผ ์ ์์ผ๋ฏ๋ก V6์์ ์ ๊ณต ๋ ์ ์์ง๋ง ์ฌ์ ํ์ด ๋ฌธ์ ์ ๋ํด ๋ ผ์ ์ค์ ๋๋ค.
์๋ง๋ ์ฐ๋ฆฌ๋ PR์ ์ฌ๋ฌ PR๋ก ๋ถํ ํ๋ ๋ฐ ์๊ฐ์ ํ ์ ํ์ฌ ์ผ๋ถ๋ฅผ ๋ ๋นจ๋ฆฌ ๋ณํฉํ๊ณ ๋ฆด๋ฆฌ์ค ํ ์ ์์ต๋๋ค.
๋ง์ ๋์์ ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค!
์ฌ๊ธฐ์๋ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. core-js
๋ฒ์ 3์ ์ฌ์ฉํ๋๋ก ์
๋ฐ์ดํธ๋์์ง๋ง react-app-polyfill
๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ํ์ฌ ๋ฒ์ 0.2.2๋ก ๋กค๋ฐฑํฉ๋๋ค.
์ด ์์ ์ฌํญ์ ํ์ธํ๋ฉด [email protected] ๋ฐ [email protected]
์์ ํจ๊ป ./storybook/webpack.config.js ํ์ผ์ ์ถ๊ฐํ์ต๋๋ค.
~ ์ฃ์กํฉ๋๋ค-@ storybook / [email protected] ์ด ์ถ์๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค-์๋์
ํธ์ง : ์ฃ์กํฉ๋๋ค-๋ค๋ฅธ ๋ฌธ์ ์์ ๋ต์ ์ฐพ๊ธฐ ์ข ๋ฃํ์ต๋๋ค. https://github.com/storybooks/storybook/issues/5893
ํด๊ฒฐ ๋ฐฉ๋ฒ
5.1.0-alpha.x๋ฅผ ์ป์ผ๋ ค๋ฉด CLI / React ๋ค์ดํฐ๋ธ์ ๋ค์ ๋ฒ์ ์ ์ฌ์ฉํ์ธ์.npx -p @ storybook / cli @ next sb init --type react_native
๋ณ์นญ์ ์ญ์ ํด๋ ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ฐ๋ฒจ ํ์ผ์ .storybook
๋ก ์ด๋ํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์์์์ต๋๋ค.
์๋ ํ์ธ์ ์ฌ๋ฌ๋ถ! ์ต๊ทผ์ด ๋ฌธ์ ์์ ๋ง์ ์ผ์ด ์ผ์ด๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค. ์ฌ์ ํ ์ง๋ฌธ, ์๊ฒฌ ๋๋ ๋ฒ๊ทธ๊ฐ ์์ผ๋ฉด ํ ๋ก ์ ๊ณ์ํ์ญ์์ค. ์ํ๊น๊ฒ๋ ๋ชจ๋ ๋ฌธ์ ๋ฅผ ๋ค๋ฃฐ ์๊ฐ์ด ์์ต๋๋ค. ์ฐ๋ฆฌ๋ ํญ์ ๊ธฐ์ฌ์ ์ด๋ ค ์์ผ๋ฏ๋ก ๋์์ด ํ์ํ๋ฉด ํ ์์ฒญ์ ๋ณด๋ด์ฃผ์ญ์์ค. ๋นํ์ฑ ๋ฌธ์ ๋ 30 ์ผ ํ์ ๋ง๊ฐ๋ฉ๋๋ค. ๊ฐ์ฌ!
^ ์ ๊ฐ ์๋ ํ์ด ๋ฌธ์ ๋ ์ฌ์ ํ ๋งค์ฐ ๋ฌธ์ ์ด๋ฉฐ ๋นํ์ฑ์ผ๋ก ํ์ํด์๋ ์๋ฉ๋๋ค.
@jdhayford AFAIK์ด ๋ฌธ์ ๋ 5.1์์ ์์ ๋์์ผ๋ฉฐ ๋ฉฐ์น ํ์ ์ถ์ ๋ ์์ ์ ๋๋ค.
@shilman ๋๋จํด! ๊ธฐ์ฌ์์๊ฒ ๊ฐ์ฌํ๊ณ ๊ฐ์ฌํฉ๋๋ค ๐
์ด ๋ฌธ์ ๋ ์ฌ์ ํ ๋ฐ์ํ๊ณ ์์ง๋ง @brycehill ์๋ฃจ์ ์ ์ฌ์ฉํ์ฌ ํด๊ฒฐํ ์์์์ต๋๋ค.
๋ณ์นญ์ ์ญ์ ํด๋ ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ฐ๋ฒจ ํ์ผ์
.storybook
๋ก ์ด๋ํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์์์์ต๋๋ค.
๋๋ ์ฌ์ ํ ๊ฐ์ ๋ฌธ์ ์ ์ง๋ฉดํ๊ณ ์์ต๋๋ค. @ByDesignGit ์ด๋ป๊ฒ ๊ณ ์น ์ ์์๋์ง ์ค๋ช ํด ์ฃผ์๊ฒ ์ต๋๊น?
์ต์ npm i core-js -D๋ฅผ ์๋์ผ๋ก ์ค์นํ์ฌ ์์ ํ ์์์์ต๋๋ค.
์ข
์์ฑ์ ์๋์ผ๋ก ์ค์นํ๋ ๊ฒ์ ์ข์ง ์์ต๋๋ค. ์ด๋ฌํ ๋ฌธ์ ๋ฅผ ๋ด๋ถ์ ์ผ๋ก ์ ์ ํ ๊ด๋ฆฌํด์ผํฉ๋๋ค.
์ ์ ํ ์์ ์ ๊ธฐ๋ค๋ฆฌ๊ณ ์์ต๋๋ค.
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด์ ์ด์ ํจํค์ง๊ฐ ์ด์ ๋ฒ์ ์ core-js (2.6.9)๋ฅผ ์ข
์์ฑ์ผ๋ก ์ค์นํ๊ณ ์ด์ ์คํ ๋ฆฌ ๋ถ์ core-js @ 3์ด ํ์ํ ์๋ ๋ฌธ์ ์๋ ๋ฐ๋๋ผ๊ณ ์๊ฐํฉ๋๋ค
@ChandanPHAI ์๋ฃจ์
์ ์ฌ์ฉํ์ฌ ์์ ์์
๋๋ ์ฌ์ ํ ๊ฐ์ ๋ฌธ์ ์ ์ง๋ฉดํ๊ณ ์์ต๋๋ค. @ByDesignGit ์ด๋ป๊ฒ ๊ณ ์น ์ ์์๋์ง ์ค๋ช ํด ์ฃผ์๊ฒ ์ต๋๊น?
.babelrc
์ .storybook
๋ก ์ฎ๊ฒจ์ ํด๊ฒฐํ์ต๋๋ค.
์ด ๋ฌธ์ ๋ ์ฌ์ ํ ๋ฐ์ํ๊ณ ์์ง๋ง @brycehill ์๋ฃจ์ ์ ์ฌ์ฉํ์ฌ ํด๊ฒฐํ ์์์์ต๋๋ค.
๋ณ์นญ์ ์ญ์ ํด๋ ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ฐ๋ฒจ ํ์ผ์
.storybook
๋ก ์ด๋ํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์์์์ต๋๋ค.
์ฌ๊ธฐ๋ ๋๊ฐ์ต๋๋ค.
ERROR in ./.storybook/config.js
Module not found: Error: Can't resolve 'core-js/modules/es.array.for-each' in '/indio-ui/.storybook'
@ ./.storybook/config.js 1:0-43
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
๋ณ์นญ์ ์ญ์ ํด๋ ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ํ์ง๋ง @ChandanPHAI๊ฐ ์ ์ํ๋๋ก npm i core-js -D
๋ฅผ ์ค์น ํ๊ณ ์๋ํ์ต๋๋ค ๐
์ ์ ํ ์์ ์ ๊ธฐ๋ค๋ฆฌ๊ณ ์์ต๋๋ค.
๋๋ ์ฌ์ ํ ๊ฐ์ ๋ฌธ์ ์ ์ง๋ฉดํ๊ณ ์์ต๋๋ค. @ByDesignGit ์ด๋ป๊ฒ ๊ณ ์น ์ ์์๋์ง ์ค๋ช ํด ์ฃผ์๊ฒ ์ต๋๊น?
.babelrc
์.storybook
๋ก ์ฎ๊ฒจ์ ํด๊ฒฐํ์ต๋๋ค.์ด ๋ฌธ์ ๋ ์ฌ์ ํ ๋ฐ์ํ๊ณ ์์ง๋ง @brycehill ์๋ฃจ์ ์ ์ฌ์ฉํ์ฌ ํด๊ฒฐํ ์์์์ต๋๋ค.
๋ณ์นญ์ ์ญ์ ํด๋ ํจ๊ณผ๊ฐ ์์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ฐ๋ฒจ ํ์ผ์
.storybook
๋ก ์ด๋ํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์์์์ต๋๋ค.
์๋ํ์ต๋๋ค! .storybook์ .babelrc๋ฅผ ๋ณต์ฌํ์ต๋๋ค.
@ arvenz0210 @ByDesignGit ์ ์ด์ ๋ ๊ฐ์ .babelrc
ํ์ผ์ ์ ์งํด์ผํ๋ค๋ ์๋ฏธ๊ฐ ์๋๋๊น? ๋ฐ๋์งํ์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค.
vue.js ํ๋ก์ ํธ๋ฅผ "@storybook/vue": "^5.1.1"
์
๊ทธ๋ ์ด๋ํ๋ฉด core-js ๋ณ์นญ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค. ๐
babel.config.js
๋ฅผ ์ฎ๊ธธ ํ์๊ฐ ์์์ต๋๋ค.vue.config.js
๋ฅผ ํตํด ์ถ๊ฐ ํ ์ฝ๊ฐ์ ๊ด๋ จ์๋ ํญ๋ชฉ์
๋๋ค.)Angular ํ๋ก์ ํธ์์๋ ์ด๊ฒ์๋ณด๊ณ ์์ผ๋ฏ๋ก .babel ํ์ผ์ด ์์ต๋๋ค. ๋ณ๋์ core-js ์ค์น ๋๋ ๋ณ์นญ ์ญ์ ๋ ์ด์ด ์์ต๋๋ค.
// console.log(config.resolve.alias);
{
'babel-runtime/core-js/object/assign': '/Development/canopy/node_modules/@storybook/core/node_modules/core-js/es/object/assign.js',
react: '~/Development/canopy/node_modules/react',
'react-dom': '/Development/canopy/node_modules/react-dom'
}
5.1.1์ ๋ชจ๋ ๊ฐ์ .
"@storybook/addon-actions": "^5.1.1",
"@storybook/addon-knobs": "^5.1.1",
"@storybook/addon-notes": "^5.1.1",
"@storybook/addon-viewport": "^5.1.1",
"@storybook/addons": "^5.1.1",
"@storybook/angular": "^5.1.1",
๋ ์ด์ ๋๋ฒ๊น ํ ์๊ฐ์ด ์์์ต๋๋ค.
@storybook/react": "^5.1.1"
ํ๊ณ ์์ผ๋ฉฐ ์๋ก์ด npm install
์ฌ์ ํ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. @ChandanPHAI ๊ฐ ์ ํ core-js
ํจํค์ง์ v2๋ฅผ ์ค์น ํ ๋ค๋ฅธ ์ข
์์ฑ ์ด ์์ต๋๋ค.
์ด PR์ ์ค๋์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํด์ผํฉ๋๋ค. @shilman ์ ๊ณง ์ ๋ฆด๋ฆฌ์ค ํ ์คํธ๋ฅผ ์ํํฉ๋๋ค. # 7051
"@storybook/react": "^5.1.3"
๊ณ์ ๋ฐ์- core-js --dev
์ค์นํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋ฌธ์ ์ ์ง๋ฉด ํ ์ฌ๋ https://github.com/storybookjs/storybook/issues/7021 ??
์ผ!! ๋ฐฉ๊ธ์ด ๋ฌธ์ ๋ฅผ ์ฐธ์กฐํ๋ PR # 7016์ด ํฌํจ ๋ https://github.com/storybookjs/storybook/releases/tag/v5.1.4 ๋ฅผ ๋ฆด๋ฆฌ์คํ์ต๋๋ค. ์ง๊ธ ์ ๊ทธ๋ ์ด๋ํ์ฌ ์ฌ์ฉํด๋ณด์ธ์!
์ด ๋ฌธ์ ๋ฅผ ๋ง๋ฌด๋ฆฌํฉ๋๋ค. ํ ์ผ์ด ๋ ๋ง๋ค๊ณ ์๊ฐ๋๋ฉด ๋ค์์ฌ์ญ์์ค.
@shilman์ด ๋ฐฉ๊ธ ์ ๋ฐ์ดํธ๋์์ผ๋ฉฐ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค ... :(
Module not found: Error: Can't resolve 'core-js/modules/web.dom-collections.iterator'
@shilman ์ ๋ ์คํ ๋ฆฌ ๋ถ๊ณผ ์ ๋์จ์ ์ต์ ๋ฒ์ ์ผ๋ก ์ ๋ฐ์ดํธํ์ต๋๋ค.
core-js์ ๊ด๋ จ๋ ์ค๋ฅ๊ฐ ๊ณ์ ๋ฐ์ํฉ๋๋ค.
npm i core-js -D๋ฅผ ์ค์นํ๋ฉด ๋ฌธ์ ๊ฐ ๋ก์ปฌ๋ก ํด๊ฒฐ๋ฉ๋๋ค.
core-js ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์์ผ๋ฉด ์๋ํ์ง ์์ต๋๋ค.
์ฝ๋์์ babel-polyfill
๋ฅผ ๊ฐ์ ธ ์ค๋์? ๊ทธ๋ ๋ค๋ฉด ์ ๊ฑฐ ํ์๊ฒ ์ต๋๊น?
๋ด๊ฐ ์ป์ ์ฌํ ๋ธ๋์น๋ฅผ ์์ ํ๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
https://github.com/umakantp/demo-repro/pull/1
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋๋ก ๋ชจ๋ ์ฑ๋์ ํตํด ๋์๊ฒ ๋ ๋ง์ ์ฌํ ์ ์ฅ์๋ฅผ ๋ณด๋ด ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค.
ํธ์ ๋ด์ ๊ฐ๊ธฐ
@ndelangen ์๋
ํ์ธ์, ๋ด ํด๋์ babel-polyfill
์ด ์์ต๋๋ค. ๋ ์ด์ ๋ณด์ฌ ๋๋ฆด ์ ์์ต๋๋ค. ๊ฐ์ธ ์ ์ฅ์์
๋๋ค.
์คํ ๋ฆฌ ๋ถ๊ณผ ๋ชจ๋ ์ ๋์จ์ด ์
๋ฐ์ดํธ๋์์ต๋๋ค.
์๋ ํ์ธ์, 5.1.4์์๋ core-js์์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. core-js๋ฅผ dev ์ข ์์ฑ์ผ๋ก ์๋ ์ค์นํ๋ ๊ฒ๋ ์๋ํ์ง ์์์ต๋๋ค.
24 ์๊ฐ ์ด๋ด์ ์ ๋ฆด๋ฆฌ์ค ์์ ์ค์ ๋๋ค!
์ดํธ !! ๋ฐฉ๊ธ์ด ๋ฌธ์ ๋ฅผ ์ฐธ์กฐํ๋ PR # 7086์ด ํฌํจ ๋ https://github.com/storybookjs/storybook/releases/tag/v5.1.5 ๋ฅผ ๋ฆด๋ฆฌ์คํ์ต๋๋ค. ์ง๊ธ ์ ๊ทธ๋ ์ด๋ํ์ฌ ์ฌ์ฉํด๋ณด์ธ์!
์ด ๋ฌธ์ ๋ฅผ ๋ง๋ฌด๋ฆฌํฉ๋๋ค. ํ ์ผ์ด ๋ ๋ง๋ค๊ณ ์๊ฐ๋๋ฉด ๋ค์์ฌ์ญ์์ค.
๋ค์๊ณผ ๊ฐ์ ๊ฑฐ์ ๋ชจ๋ ๊ตฌ์ฑ ์์์ ๋ํด ์ฌ์ ํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
ERROR in ./src/components/list/VirtualizedList.jsx
Module not found: Error: Cannot find module 'C:\ProjectDirectory\node_modules\@storybook\addon-storysource\loader.js!C:\ProjectDirectory\node_modules\core-js\modules\web.dom-collections.iterator.js'
@ ./src/components/list/VirtualizedList.jsx 19:0-54
@ ./src/components/list/index.js
@ ./src/components/list/List.story.jsx
@ ./src/components sync story\.jsx?$
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js (webpack)-hot-middleware/client.js?reload=true
๋๋ ๊ทธ๊ฒ์ ๋ฐฐ์ ํ์ง ์๊ณ ๋ด ์๋ชป ์ผ ์์๋ค. ์ ์บ์๋ฅผ ํด๋ ๋ํ๊ณ yarn.lock์ ์ญ์ ํ๊ณ ๋ชจ๋ ์ข
์์ฑ์ ์ต์ ๋ฒ์ ์ ์ค์นํ์ต๋๋ค. core-js๋ฅผ ์ข
์์ฑ์ผ๋ก ์ค์นํ์ง ์์์ง๋ง @babel/preset-env
์ ๊ฐ์ ์ฌ์ ์ค์ ๊ณผ ํจ๊ป babel์ ์ฌ์ฉํฉ๋๋ค. ์ฌ์ฉ์ ์ง์ ์นํฉ ๊ตฌ์ฑ์ด ์์ต๋๋ค.
const path = require('path');
const { DefinePlugin } = require('webpack');
const buildTimeConfig = require('../buildTimeConfig');
const resolveLocalDirectory = relativePath => path.resolve(__dirname, '../', relativePath);
module.exports = async ({ config }) => {
config.resolve.extensions.push('.jsx');
config.resolve.extensions.push('.json');
config.plugins.push(
new DefinePlugin({
SUPPORTED_LOCALES: `'${buildTimeConfig.REQUIRED_LOCALES}'`,
}),
);
config.resolve.alias = {
$components: resolveLocalDirectory('src/components'),
};
config.module.strictExportPresence = true;
config.module.rules.push({
test: /\.jsx?$/,
loaders: [require.resolve('@storybook/addon-storysource/loader')],
enforce: 'pre',
});
// Unsafe override of css-modules rule for the following
// https://github.com/storybooks/storybook/issues/6083.
config.module.rules[2] = {
oneOf: [
{
test: /\.module\.(scss|css)$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
localsConvention: 'camelCaseOnly',
importLoaders: 1,
modules: {
localIdentName: '[local]_[hash:5]',
},
sourceMap: true,
},
},
'sass-loader',
],
},
{
test: /(?<!\.module)\.(scss|css)$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
sourceMap: true,
},
},
'sass-loader',
],
},
{
test: /\.json$/,
include: /node_modules\/emoji-dictionary/,
loader: 'json-loader',
},
{
exclude: /\.(js|jsx|ejs|html|json|md)$/,
loader: 'file-loader',
options: { name: 'assets/[name].[ext]' },
},
],
};
return config;
};
@filippoitaliano ๋๋ ๋๊ฐ์ ์ค๋ฅ๊ฐ ์์ต๋๋ค. ํ์ผ์ด core-js ๋ชจ๋ ๊ฒฝ๋ก์ ์๊ณ babel ์ฌ์ ์ค์ ์ core-js 3์ด ํ์ฑํ๋์ด ์์์ ํ์ธํ ์ ์์ง๋ง ์ฌ์ ํ ์คํจํฉ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๊น?
ํธ์งํ๋ค:
addon-storysource๋ฅผ ์ ๊ฑฐํ๋ฉด ์์๋๋ก ์๋ํฉ๋๋ค. ๊ทธ๋๋ ์์ธ์ด ํ์คํ์ง ์์ต๋๋ค.
ํธ์ง 2 :
๋ ๊น์ด ํ์ญ์์ค. ์ด๋ค ์ด์ ๋ก ์คํ ๋ฆฌ ์์ค ๋ก๋๋ ์ ๋์จ ํจ๋์ ํ์ํ๊ธฐ ์ํด ๋ชจ๋ .js ํ์ผ์ด ์์ด์ผํ๋ฉฐ ๊ตฌ์ฑ์์ ๋
ธ๋ ๋ชจ๋์ ์ ์ธํด์ผํ์ต๋๋ค.
{
test: /\.js$/,
exclude: /node_modules/,
loaders: [require.resolve('@storybook/addon-storysource/loader')],
enforce: 'pre',
}
# 3626 # 6984์ ๊ด๋ จ์ด์์ ์ ์์ต๋๋ค.
cc @ igor-dv @libetl โ๏ธ
@ aga5tya ์, ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. node_modules๋ฅผ ์ ์ธํ๊ณ ๋ชจ๋ ๊ฒ์ด ์ ์๋ํฉ๋๋ค!
๋๋ :
"corejs": 3
์ถ๊ฐyarn add corejs@3
exclude: /node_modules/,
์ถ๊ฐimport 'babel-polyfill'
์ ๊ฑฐbabel polyfill์ ๋ ์ด์ ์ฌ์ฉ๋์ง ์์ผ๋ฉฐ ๋ชจ๋ ๊ณณ์์ core-js๋ก ๋์ฒด๋์ด์ผํฉ๋๋ค.
๋๋ airbnb-browser-shims :-p
์ด๋ ์ชฝ์ด๋ node_modules๋ ํญ์ ํธ๋์ค ํ์ผ์์ ์ ์ธ๋์ด์ผํฉ๋๋ค.
๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ์์ต๋๋ค.
./.storybook/config.js์ ์ค๋ฅ
๋ชจ๋์ ์ฐพ์ ์ ์์ : ์ค๋ฅ : 'core-js / modules / web.dom.iterable'๋ชจ๋์ ์ฐพ์ ์ ์์ต๋๋ค.
Storybook / vue 5.1.9๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
@flowck ํ๋ก์ ํธ ๋ฃจํธ์ core-js v3๋ฅผ ์ค์นํ์ญ์์ค.
core-js๋ฅผ ์ ํ ์ฌ์ฉํ์ง ์๊ณ ์คํ ๋ฆฌ ๋ถ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์ฐพ์ ์ ์์ต๋๊น? ์๋น์๊ฐ ์์ ์ ์ฌ์ ์ ๊ณต ํ ์์๋ ์ด์ ๋ ๋ฌด์์ ๋๊น?
babel-polyfills๋ ๋ด๊ฐ ์ฌ์ฉํด์ผํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ dep์ ๋๋ค. ์ด ๊ฒฝ์ฐ ์ด๋ป๊ฒ ๋ํ์ฑ ์ ์คํํ ์ ์์ต๋๊น?
yarn upgrade interactive --latest
ํ๊ณ ๋ชจ๋ ์คํ ๋ฆฌ ๋ถ ๊ด๋ จ ์ข
์์ฑ์ ์
๊ทธ๋ ์ด๋ํ์ผ๋ฉฐ ์ด์ ์๋ ์ค์
๋๋ค! ๐
์ฐธ๊ณ :์ด ์ค๋ฅ๋ @storybook/addon-knobs
์ ๋์จ์ ์ถ๊ฐ ํ ํ์ ๋ง โโ๋ฐ์ํ์ต๋๋ค.
@ chadlavi-casebook uhm, webpack ๋ฌด์ ํ๋ฌ๊ทธ์ธ์ ์ถ๊ฐํด ๋ณผ ์ ์์ต๋๊น?
https://webpack.js.org/plugins/ignore-plugin/
@ storybook / vue 5.1.9๋ฅผ ์คํํ๋ ๊ฒ๊ณผ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. yarn why core-js
์คํ ๊ฒฐ๊ณผ :
=> Found "[email protected]"
info Has been hoisted to "core-js"
info Reasons this module exists
- "workspace-aggregator-20eaddfd-71c7-48bf-a12d-ecca73d8226d" depends on it
- Hoisted from "_project_#@storybook#addon-knobs#core-js"
- Hoisted from "_project_#@storybook#addon-viewport#core-js"
- Hoisted from "_project_#@storybook#vue#core-js"
- Hoisted from "_project_#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#addons#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#client-api#core-js"
- Hoisted from "_project_#@storybook#addon-viewport#@storybook#client-logger#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#components#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#core-events#core-js"
- Hoisted from "_project_#@storybook#vue#@storybook#core#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#theming#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#addons#@storybook#api#core-js"
- Hoisted from "_project_#@storybook#vue#@storybook#core#@storybook#channel-postmessage#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#addons#@storybook#channels#core-js"
- Hoisted from "_project_#@storybook#vue#@storybook#core#@storybook#node-logger#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#client-api#@storybook#router#core-js"
- Hoisted from "_project_#@storybook#vue#@storybook#core#@storybook#ui#core-js"
- Hoisted from "_project_#@storybook#vue#@storybook#core#lazy-universal-dotenv#core-js"
- Hoisted from "_project_#@storybook#addon-knobs#@storybook#components#simplebar-react#simplebar#core-js"
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
=> Found "@vue/babel-preset-app#[email protected]"
info This module exists because "_project_#@vue#cli-plugin-babel#@vue#babel-preset-app" depends on it.
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "@babel/runtime-corejs2#[email protected]"
info This module exists because "_project_#@vue#cli-plugin-babel#@vue#babel-preset-app#@babel#runtime-corejs2" depends on it.
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "fbjs#[email protected]"
info This module exists because "_project_#@storybook#addon-knobs#@storybook#components#recompose#fbjs" depends on it.
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
=> Found "babel-runtime#[email protected]"
info This module exists because "_project_#@storybook#addon-knobs#@storybook#components#react-syntax-highlighter#babel-runtime" depends on it.
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
โ
devDependencies์ core-js@^2.6.9
๋ฅผ ์ถ๊ฐํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋จผ์ node_modules๋ฅผ ์ญ์ ํ์ญ์์ค.
rm -rf node_modules
v5.1.9
์์ v5.0.6
v5.1.9
๋ก ์
๊ทธ๋ ์ด๋ ํ ํ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
๊ฐ์ ๋ฌธ์ . v5.1.9
์์ v5.0.6
๋ค์ด ๊ทธ๋ ์ด๋ ํ ํ ์์ ๋จ
@JamyGolden & @Exomnius ์ค์ ์ ๋ํด ๋ ๋ง์ด ๊ณต์ ํด ์ฃผ์๊ฒ ์ต๋๊น?
yarn why core-js
์ ์ถ๋ ฅ์ ๋์์ด๋๋ฉฐ ์ฌ์์ฐ ์ ์ฅ์๋ ํจ์ฌ ๋ ์ ์ฉํฉ๋๋ค.
@ndelangen ์ง๊ธ ๋ฌธ์ ์์ด 5.1.9
์
๊ทธ๋ ์ด๋ํ์ต๋๋ค. ์๋ก์ด ํจ์น ์ข
์์ฑ์ด ์ค์น๋์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ ๋ ๊ฒ ๊ฐ์ต๋๋ค ๐คทโโ๏ธ
ํธ์ง, ๋ค์ ๋ค์ด ๊ทธ๋ ์ด๋ํด์ผํ๊ณ CI ํ
์คํธ์ ์คํจํ์ต๋๋ค. ๋๋ ๊ทธ๊ฒ์ yarn why core-js
๋ฅผํ๋ค :
$ yarn why core-js
yarn why v1.17.3
[1/4] ๐ค Why do we have the module "core-js"...?
[2/4] ๐ Initialising dependency graph...
[3/4] ๐ Finding dependency...
[4/4] ๐ก Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "core-js"
info Reasons this module exists
- Hoisted from "@storybook#react#core-js"
- Hoisted from "@storybook#addon-actions#core-js"
- Hoisted from "@storybook#addon-links#core-js"
- Hoisted from "@storybook#addon-storyshots#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#components#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#api#core-js"
- Hoisted from "@storybook#react#@storybook#core#core-js"
- Hoisted from "@storybook#addon-links#@storybook#core-events#core-js"
- Hoisted from "@storybook#addon-storyshots#@storybook#addons#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#theming#core-js"
- Hoisted from "@storybook#react#@storybook#node-logger#core-js"
- Hoisted from "@storybook#addon-links#@storybook#router#core-js"
- Hoisted from "@storybook#addon-storyshots#@storybook#addons#@storybook#channels#core-js"
- Hoisted from "@storybook#react#@storybook#core#@storybook#channel-postmessage#core-js"
- Hoisted from "@storybook#react#@storybook#core#@storybook#client-api#core-js"
- Hoisted from "@storybook#react#@storybook#core#@storybook#ui#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#theming#@storybook#client-logger#core-js"
- Hoisted from "@storybook#react#@storybook#core#lazy-universal-dotenv#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#components#simplebar-react#simplebar#core-js"
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
=> Found "protractor-flake#[email protected]"
info This module exists because "protractor-flake" depends on it.
info Disk size without dependencies: "3.45MB"
info Disk size with unique dependencies: "3.45MB"
info Disk size with transitive dependencies: "3.45MB"
info Number of shared dependencies: 0
=> Found "core-js-compat#[email protected]"
info This module exists because "@babel#preset-env#core-js-compat" depends on it.
info Disk size without dependencies: "6.63MB"
info Disk size with unique dependencies: "6.63MB"
info Disk size with transitive dependencies: "6.63MB"
info Number of shared dependencies: 0
=> Found "babel-runtime#[email protected]"
info This module exists because "social-tags-webpack-plugin#babel-runtime" depends on it.
info Disk size without dependencies: "7.66MB"
info Disk size with unique dependencies: "7.66MB"
info Disk size with transitive dependencies: "7.66MB"
info Number of shared dependencies: 0
=> Found "node-plop#[email protected]"
info This module exists because "plop#node-plop" depends on it.
info Disk size without dependencies: "7.66MB"
info Disk size with unique dependencies: "7.66MB"
info Disk size with transitive dependencies: "7.66MB"
info Number of shared dependencies: 0
=> Found "babel-polyfill#[email protected]"
info This module exists because "flow-typed#babel-polyfill" depends on it.
info Disk size without dependencies: "7.66MB"
info Disk size with unique dependencies: "7.66MB"
info Disk size with transitive dependencies: "7.66MB"
info Number of shared dependencies: 0
=> Found "fbjs#[email protected]"
info This module exists because "@storybook#addon-actions#@storybook#components#recompose#fbjs" depends on it.
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
โจ Done in 1.94s.
๋ก์ปฌ์์ ์๋ํ์ง๋ง CI์ ์ฌ์ ํ ๋์ผํ ์ค๋ฅ๊ฐ ์์ต๋๊น?
@ndelangen ๊ทธ๋ CI์ ๋ค๋ฅธ ๊ฐ๋ฐ์๊ฐ ๋ฌธ์ ๋ฅผ ๊ฒช๊ณ ์์ง๋ง (๋ด๊ฐ ํ๋ณดํ๋ฉด ์์ฌ / ๋
ธ๋ ๋ฒ์ ์ผ๋ก ์
๋ฐ์ดํธ ํ ๊ฒ์
๋๋ค) ๋ด ํธ์ ๊ด์ฐฎ์ต๋๋ค (์์ฌ 1.15.2
, ๋
ธ๋ 8.15.1
), ์ฐ๋ฆฌ๋ ์ ๊ธ ํ์ผ์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ์๋ ์คํจํ yarn why core-js
์ด๊ณ ์ด๊ฒ์ ๋ด ๊ฒ์
๋๋ค.
yarn why core-js
yarn why v1.15.2
warning ../package.json: No license field
[1/4] ๐ค Why do we have the module "core-js"...?
[2/4] ๐ Initialising dependency graph...
[3/4] ๐ Finding dependency...
[4/4] ๐ก Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "core-js"
info Reasons this module exists
- Hoisted from "@storybook#react#core-js"
- Hoisted from "@storybook#addon-actions#core-js"
- Hoisted from "@storybook#addon-links#core-js"
- Hoisted from "@storybook#addon-storyshots#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#components#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#api#core-js"
- Hoisted from "@storybook#react#@storybook#core#core-js"
- Hoisted from "@storybook#addon-links#@storybook#core-events#core-js"
- Hoisted from "@storybook#addon-storyshots#@storybook#addons#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#theming#core-js"
- Hoisted from "@storybook#react#@storybook#node-logger#core-js"
- Hoisted from "@storybook#addon-links#@storybook#router#core-js"
- Hoisted from "@storybook#addon-storyshots#@storybook#addons#@storybook#channels#core-js"
- Hoisted from "@storybook#react#@storybook#core#@storybook#channel-postmessage#core-js"
- Hoisted from "@storybook#react#@storybook#core#@storybook#client-api#core-js"
- Hoisted from "@storybook#react#@storybook#core#@storybook#ui#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#theming#@storybook#client-logger#core-js"
- Hoisted from "@storybook#react#@storybook#core#lazy-universal-dotenv#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#components#simplebar-react#simplebar#core-js"
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
=> Found "protractor-flake#[email protected]"
info This module exists because "protractor-flake" depends on it.
info Disk size without dependencies: "3.45MB"
info Disk size with unique dependencies: "3.45MB"
info Disk size with transitive dependencies: "3.45MB"
info Number of shared dependencies: 0
=> Found "core-js-compat#[email protected]"
info This module exists because "@babel#preset-env#core-js-compat" depends on it.
info Disk size without dependencies: "6.63MB"
info Disk size with unique dependencies: "6.63MB"
info Disk size with transitive dependencies: "6.63MB"
info Number of shared dependencies: 0
=> Found "babel-runtime#[email protected]"
info This module exists because "social-tags-webpack-plugin#babel-runtime" depends on it.
info Disk size without dependencies: "7.66MB"
info Disk size with unique dependencies: "7.66MB"
info Disk size with transitive dependencies: "7.66MB"
info Number of shared dependencies: 0
=> Found "node-plop#[email protected]"
info This module exists because "plop#node-plop" depends on it.
info Disk size without dependencies: "7.66MB"
info Disk size with unique dependencies: "7.66MB"
info Disk size with transitive dependencies: "7.66MB"
info Number of shared dependencies: 0
=> Found "babel-polyfill#[email protected]"
info This module exists because "flow-typed#babel-polyfill" depends on it.
info Disk size without dependencies: "7.66MB"
info Disk size with unique dependencies: "7.66MB"
info Disk size with transitive dependencies: "7.66MB"
info Number of shared dependencies: 0
=> Found "fbjs#[email protected]"
info This module exists because "@storybook#addon-actions#@storybook#components#recompose#fbjs" depends on it.
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
โจ Done in 2.85s.
๋ชจ๋ ์ด์ค ์ ์ ์กด์ฌํ๋ ๋์ผํ ์ค๋ฅ์ ์ :
FAIL path/to/test/index.spec.js
โ Test suite failed to run
Cannot find module 'core-js/modules/es6.symbol' from 'localMocksFile.js'
์ํ, ์คํ ๋ฆฌ ๋ถ์ ์ ์์ ์ผ๋ก ์คํ๋๊ณ ์์ง๋ง ํ ์คํธ๋ ์ฌ์ ํ ์ค๋๋ core-js ๋ฒ์ ์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค!
localMocksFile.js
์์ ๋ฌด์์ด ์์ต๋๊น? ์๋ง๋ ๋น์ ์ดํด์ผ ํ ์ผ์ ๊ทธ 1 ๊ฐ์ ํ์ผ์ ์
๋ฐ์ดํธํ๋ ๊ฒ์
๋๋ค.
@ndelangen ์ด์ ์ ๋ถ์ฌ ๋ฃ์ ์ค๋ฅ๋ ์คํ ๋ฆฌ ์ท ์คํ๊ณผ ๊ด๋ จ์ด ์์ต๋๋ค (์คํ ๋ฆฌ ๋ถ ๋ฒ์ ์ ์
๋ฐ์ดํธ ํ ํ์ ๋ง โโ๋ฐ์ ํจ). yarn storybook
์คํํ ๋ ๋ค๋ฅธ ๊ฐ๋ฐ์๊ฐ๋ฐ๋ ์ค๋ฅ์๋ ์ ์ฌํ ์ค๋ฅ๊ฐ ๋ง์ด ํฌํจ๋์ด ์์ผ๋ฉฐ ๋ชจ๋ ํ์ผ์ ์ค๋ฅ๊ฐ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
Entrypoint main [big] = runtime~main.78e9af38499895fecc3d.bundle.js runtime~main.78e9af38499895fecc3d.bundle.js.map vendors~main.78e9af38499895fecc3d.bundle.js vendors~main.78e9af38499895fecc3d.bundle.js.map main.78e9af38499895fecc3d.bundle.js main.78e9af38499895fecc3d.bundle.js.map
[0] multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true 64 bytes {main} [built]
[./.storybook/config.js] 368 bytes {main} [built]
[./app sync recursive \.stories\.(js|jsx)$] ./app sync \.stories\.(js|jsx)$ 5.07 KiB {main} [built]
[./node_modules/@storybook/core/dist/server/common/polyfills.js] 120 bytes {vendors~main} [built]
[./node_modules/@storybook/core/dist/server/preview/globals.js] 93 bytes {vendors~main} [built]
[./node_modules/@storybook/core/node_modules/webpack/buildin/harmony-module.js] (webpack)/buildin/harmony-module.js 573 bytes {vendors~main} [built]
[./node_modules/@storybook/core/node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {vendors~main} [built]
[./node_modules/@storybook/react/dist/client/index.js] 1.26 KiB {vendors~main} [built]
[./node_modules/airbnb-js-shims/index.js] 40 bytes {vendors~main} [built]
[./node_modules/core-js/features/symbol/index.js] 251 bytes {vendors~main} [built]
[./node_modules/global/window.js] 232 bytes {vendors~main} [built]
[./node_modules/mockdate/src/mockdate.js] 1.78 KiB {vendors~main} [built]
[./node_modules/querystring-es3/index.js] 127 bytes {vendors~main} [built]
[./node_modules/regenerator-runtime/runtime.js] 23 KiB {vendors~main} [built]
[./node_modules/webpack-hot-middleware/client.js?reload=true] 7.68 KiB {vendors~main} [built]
+ 1352 hidden modules
ERROR in ./app/helpers/device.js
Module not found: Error: Cannot find module 'core-js/modules/es6.regexp.match'
@ ./app/helpers/device.js 1:0-42 1:42-84
@ ./app/helpers/index.js
@ ./app/components/Button/index.js
@ ./app/components/Button/__tests__/index.stories.js
@ ./app sync \.stories\.(js|jsx)$
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
...
์ด๊ฒ์ด ์ ์ฉํ ์ ๋ณด์ธ์ง ํ์คํ์ง ์์ง๋ง @babel/polyfill
๋ ํ๋ก์ ํธ์ ๊ธฐ๋ณธ package.json์ ํฌํจ๋์ด ์์ง ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ์์ต๋๋ค.
./.storybook/config.js์ ์ค๋ฅ
๋ชจ๋์ ์ฐพ์ ์ ์์ : ์ค๋ฅ : 'core-js / modules / web.dom.iterable'๋ชจ๋์ ์ฐพ์ ์ ์์ต๋๋ค.Storybook / vue 5.1.9๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
https://www.npmjs.com/package/babel-loader ๋ฅผ ์ค์นํ์ฌ ํด๊ฒฐ๋์์ต๋๋ค.
package.json
"dependencies": {
"babel-loader": "^8.0.6"
},
"devDependencies": {
"@storybook/addon-actions": "^5.1.11",
"@storybook/addon-links": "^5.1.11",
"@storybook/addons": "^5.1.11",
"@storybook/react": "^5.1.11"
}
์ด๊ฒ์ ์์ ์ด ์๋ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด์ง๋ง ๋ชจ๋ Storybook ํจํค์ง (์ ๋์จ ํฌํจ)๋ฅผ v 5.0.6์ผ๋ก ๋กค๋ฐฑํ๋ฉด์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค. ์ด ์ค๋ ๋์ ๋ค๋ฅธ ๊ฒ์ ๋์์ด๋์ง ์์์ต๋๋ค.
(์๋์ React + Yarn ๋ช ๋ น์ด์ง๋ง NPM / Vue๋ก ์ฝ๊ฒ ๋ณํ ๊ฐ๋ฅ) :
๋จผ์ :
yarn remove @storybook/react @storybook/addon-actions @storybook/addon-knobs @storybook/addon-links @storybook/addon-notes @storybook/addons @storybook/addon-storyshots
๋ค์ :
yarn add @storybook/[email protected] @storybook/[email protected] @storybook/[email protected] @storybook/[email protected] @storybook/[email protected] @storybook/[email protected] @storybook/[email protected]
์คํ ๋ฆฌ ๋ถ์ ์คํํ๋ ค๊ณ ํ ๋ samme ๋ฌธ์ ๊ฐ ๋ํ๋ฉ๋๋ค.
ERROR in ./src/lib/helpers.js
Module not found: Error: Cannot find module 'core-js/modules/web.dom.iterable'
@ ./src/lib/helpers.js 16:0-43
@ ./src/components/Person.js
@ ./src/components/Person.stories.js
@ ./src sync \.stories\.js$
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js (webpack)-hot-middleware/client.js?reload=true&quiet=true
์ด๋ nvm์ ์ฌ์ฉํ์ฌ ๋ ธ๋ v12๋ก ์ ๋ฐ์ดํธ ํ ํ์ ๋ฐ์ํ์ต๋๋ค.
polyfill ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด์ด ์์ ์ ์ํํด์ผํ๋ฏ๋ก ๋ ธ๋๋ฅผ ๋ค์ด ๊ทธ๋ ์ด๋ ํ ์ ์์ต๋๋ค. ๊ทธ ์ ์๋ ๋ชจ๋ ๊ฒ์ด ์๋ํ์ต๋๋ค. ๋ถํํ๋ ๋๋ ๊ทธ ์ ์ ๋ด๊ฐ ์ด๋ค ๋ ธ๋ ๋ฒ์ ์ ์ฌ์ฉํ๋์ง ๋ชจ๋ฆ ๋๋ค. ์ด ์ค๋ ๋์์ ๋ชจ๋ ๊ฒ์ ์๋ํ์ง๋ง 5.0.6์ผ๋ก ๋กค๋ฐฑํ๊ณ ์ถ์ง ์์ต๋๋ค.์ด ํ๋ก์ ํธ์ ์คํ ๋ฆฌ ๋ถ์ ์ค์ ํ๋ ํฐ ์ด์ ๋ ์ ๋ฌธ์๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ๋๋ค. ๋๋ ์ฌ๊ธฐ์ ๋ชจ๋ ๊ฒ์ ๋ฐ์๋ค : https://github.com/netliferesearch/netlife2019/tree/storybook_setup_stories
ํธ์ง : ๋ ธ๋๋ฅผ ๋ค์ด ๊ทธ๋ ์ด๋ํ๋๋ฐ ์ฌ์ ํ ์๋ํ์ง ์์ต๋๋ค. ๊ฒ์ํ๊ธฐ ์ ์ ์๋ ํ์ด์ผํฉ๋๋ค. ๋๋ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง ์กฐ๊ธ ์์ด ๋ฒ๋ ธ๋ค. ๋๋ ๊ณ์ ์ฐพ์ ๋ณผ ๊ฒ์ด๋ค.
Nuxt.js v2.10.1 ์ธ์ @storybook/vue
5.2.5๋ฅผ ์ฌ์ฉํ๊ณ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. yarn storybook
์๋ํ์ง๋ง yarn build
๋๋ ๊ธฐํ nuxt ๊ด๋ จ ์์
์ด ์คํจํ์ต๋๋ค. yarn why core-js
๋ ๋ค์๊ณผ ๊ฐ์ ์ถ๋ ฅ์ ์ ๊ณตํฉ๋๋ค.
$ yarn why core-js
yarn why v1.17.3
[1/4] ๐ค Why do we have the module "core-js"...?
[2/4] ๐ Initialising dependency graph...
[3/4] ๐ Finding dependency...
[4/4] ๐ก Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "core-js"
info Reasons this module exists
- Hoisted from "@storybook#addon-actions#core-js"
- Hoisted from "@storybook#addon-knobs#core-js"
- Hoisted from "@storybook#addon-links#core-js"
- Hoisted from "@storybook#addon-viewport#core-js"
- Hoisted from "@storybook#addons#core-js"
- Hoisted from "@storybook#vue#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#api#core-js"
- Hoisted from "@storybook#addons#@storybook#channels#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#client-api#core-js"
- Hoisted from "@storybook#addon-viewport#@storybook#client-logger#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#components#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#core-events#core-js"
- Hoisted from "@storybook#vue#@storybook#core#core-js"
- Hoisted from "@storybook#addon-links#@storybook#router#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#theming#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#client-api#@storybook#channel-postmessage#core-js"
- Hoisted from "@storybook#vue#@storybook#core#@storybook#node-logger#core-js"
- Hoisted from "@storybook#vue#@storybook#core#@storybook#ui#core-js"
- Hoisted from "@storybook#vue#@storybook#core#lazy-universal-dotenv#core-js"
- Hoisted from "@storybook#addon-actions#@storybook#components#simplebar-react#simplebar#core-js"
info Disk size without dependencies: "7.02MB"
info Disk size with unique dependencies: "7.02MB"
info Disk size with transitive dependencies: "7.02MB"
info Number of shared dependencies: 0
=> Found "babel-runtime#[email protected]"
info This module exists because "@storybook#addon-actions#react-inspector#babel-runtime" depends on it.
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "@nuxt/babel-preset-app#[email protected]"
info This module exists because "nuxt#@nuxt#webpack#@nuxt#babel-preset-app" depends on it.
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "@vue/babel-preset-app#[email protected]"
info This module exists because "vuepress#@vuepress#core#@vue#babel-preset-app" depends on it.
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "@babel/runtime-corejs2#[email protected]"
info This module exists because "vuepress#@vuepress#core#@vue#babel-preset-app#@babel#runtime-corejs2" depends on it.
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "fbjs#[email protected]"
info This module exists because "@storybook#addon-links#@storybook#router#@reach#router#create-react-context#fbjs" depends on it.
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
โจ Done in 1.25s.
๊ทธ๋์ @frebro ์์ ์ ๊ณตํ๋ ๊ฒ๊ณผ ๋์ผํ ์ ๊ทผ ๋ฐฉ์์ ์ฌ์ฉํฉ๋๋ค.
$ yarn add -D [email protected]
๋ฐ ๐ : ์์
ํ๊ฒฝ์ด ์๊ฒผ์ต๋๋ค : yarn storybook
, yarn build
๋ฐ ๋ค๋ฅธ ๋ชจ๋ ์์
์ด ๋ค์ ์๋ํฉ๋๋ค.
@rwam yarn add -D [email protected] ๋ด ์คํ ๋ฆฌ ๋ถ 5.2.5 HTML ํ๋ก์ ํธ thx dude :)
'core-js': '^3.*.*':
ERROR in ./.storybook/config.js
Module not found: Error: Cannot find module 'core-js/modules/web.dom.iterable'
'core-js': '^2.*.*':
// many errors from storybook and addons
Cannot find module 'core-js/modules/***'
"@vue/cli*": "^4.0.5", depends on 'core-js': '^3.*.*'
"@vue/cli*": "^3.*.*", depends on 'core-js': '^2.*.*'
"@storybook/vue": "^5.1.0", depends on 'core-js': '^3.*.*' with d.ts
"@storybook/vue": "^5.0.6", depends on 'core-js': '^2.*.*' but without d.ts
๋ด ์์ deps :
"@vue/cli*": "^4.0.5", depends on 'core-js': '^3.*.*'
"@storybook/vue": "^5.1.0", depends on 'core-js': '^3.*.*' with d.ts
https://cli.vuejs.org/migrating-from-v3/#migrating -from-v3
Invalid Option: corejs is not a valid top-level option
: -rm -rf node_modules
.
๋น์ ๊ณผ ๋น์ ์ ์ฌ๋ํ๋ ์ฌ๋๋ค์๊ฒ ๊ฑด๊ฐ;)
Nuxt ํ๋ก์ ํธ์์ Storybook์ด ์๋ํ๋๋กํ๋ ๋ ๊ฐ๋ ฅํ ์๋ฃจ์ ์ ์ฐพ์์ต๋๋ค. ํด๊ฒฐ์ฑ ์ core-js์ ๋ฒ์ ๋ถ์ผ์น์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค. Nuxt๋ ๊ธฐ๋ณธ ๋ฒ์ 2์ Storybook ๋ฒ์ 3์ ์ฌ์ฉํฉ๋๋ค. ๋ฐ๋ผ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด @ nuxt / babel-preset-app ์์ด ๋ฉ๋ชจ๋ฅผ ๋ฐ๋ผ์ผ
์ฐธ๊ณ : core-js @ 2 ๋ฐ core-js @ 3 ์ ๋ชจ๋ Babel 7.4.0์์ ์ง์๋๋ฏ๋ก core-js๋ฅผ ์ง์ ์ถ๊ฐํ๊ณ corejs ์ต์ ์ ํตํด ๋ฒ์ ์ ์ค์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
๋ด nuxt.config.js ์์์ด ์ ๋ฐ์ดํธ ๋ฅผ ์ฌ์ฉํ์ฌ Nuxt 2.11.0์ผ๋ก ์์ ํ๊ฒฝ์ ๋ค์ ์ป์ต๋๋ค .
yarn add --dev core-js<strong i="15">@3</strong> @babel/runtime-corejs3
export default {
โฆ
build: {
babel: {
presets() {
return [
[
'@nuxt/babel-preset-app',
{
corejs: { version: 3 }
}
]
]
}
}
}
}
์ต์ํ ํ๋์ ๊ตฌ์ฑ ์์๊ฐ ์ ์ ์ฟผ๋ฆฌ๋ฅผ ์ฌ์ฉํ๊ณ ์์ ๋ ์คํ ๋ฆฌ ๋ถ (5.3.18)์ gatsby v2์ ์ถ๊ฐํ๋ ค๊ณ ํ ๋ ๋์ผํ ๋ฌธ์ ์ ์ง๋ฉดํ์ต๋๋ค. @brycehill์ ์ํด ์ ์ ์ด๋ .babelrc๋ ์ผ .storybookํฉ๋๋ค.
Nuxt ํ๋ก์ ํธ์์ Storybook์ด ์๋ํ๋๋กํ๋ ๋ ๊ฐ๋ ฅํ ์๋ฃจ์ ์ ์ฐพ์์ต๋๋ค. ํด๊ฒฐ์ฑ ์ core-js์ ๋ฒ์ ๋ถ์ผ์น์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค. Nuxt๋ ๊ธฐ๋ณธ ๋ฒ์ 2์ Storybook ๋ฒ์ 3์ ์ฌ์ฉํฉ๋๋ค. ๋ฐ๋ผ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด @ nuxt / babel-preset-app ์์ด ๋ฉ๋ชจ๋ฅผ ๋ฐ๋ผ์ผ
์ฐธ๊ณ : core-js @ 2 ๋ฐ core-js @ 3 ์ ๋ชจ๋ Babel 7.4.0์์ ์ง์๋๋ฏ๋ก core-js๋ฅผ ์ง์ ์ถ๊ฐํ๊ณ corejs ์ต์ ์ ํตํด ๋ฒ์ ์ ์ค์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
๋ด nuxt.config.js ์์์ด ์ ๋ฐ์ดํธ ๋ฅผ ์ฌ์ฉํ์ฌ Nuxt 2.11.0์ผ๋ก ์์ ํ๊ฒฝ์ ๋ค์ ์ป์ต๋๋ค .
yarn add --dev core-js<strong i="16">@3</strong> @babel/runtime-corejs3
export default { โฆ build: { babel: { presets() { return [ [ '@nuxt/babel-preset-app', { corejs: { version: 3 } } ] ] } } } }
๋๋จํด, ๋๋ฅผ ์ํด ์ผํ๋ค!
@masives ๊ฐ์ธ ๋น ์ ๊ฐ์ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ด ๋ฌธ์ ์์ ์ฐพ์ ์์๋ ๊ฒ ๊ฐ์ผ๋ฏ๋ก ์ฃผ์ / .babelrc์ ๋ํ ๋งํฌ๋ฅผ ๊ฒ์ ํ ์ ์์ต๋๊น?
Nvm. ํ์ด์ง ๋๋ ํ ๋ฆฌ์์๋ ์คํ ๋ฆฌ๋ก ์ธํด ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ํ์ด์ง ์คํ ๋ฆฌ๋ฅผ __stories__๋ก ์ด๋ํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
Next.js 9.1.1-> Next.js 9.4.4๊ฐ ๋๋ฅผ ๊ดด๋กญ ํ์ต๋๋ค.
npm list core-js
์ ๊ฒฐ๊ณผ๋ฅผ ๋น๊ตํ๋ฉด Next๋ฅผ ์
๋ฐ์ดํธ ํ ํ core js์ babel ๋ฐํ์์ด ๋๋ฝ ๋ ๊ฒ์ผ๋ก ๋ํ๋ฌ์ต๋๋ค. ์ด ๋๋ฝ ๋ ํจํค์ง๋ฅผ dev ์ข
์์ฑ ๋ฐ LO์ ๋ค์ ์ค์นํ๊ณ ์๋ํ์ต๋๋ค.
cc @ndelangen
core-js v2์์ v3 ๋ก์ ๋ง์ด๊ทธ๋ ์ด์ ์ ์ฒ๋ฆฌํ๋ ๋์ ๋ฒ์ 5.3.19์ ๋์ผํ ๋ฌธ์
๋์๊ฒ๋ ๊ฐ์ ๋ฌธ์ ์
๋๋ค. @denimamab ์ฒ๋ผ ์ ๋ 5.3.19
๋ฒ์ ์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
๋ค์์ ์ฌ์ฉํ์ฌ ๋ก์ปฌ๋ก ์์ ํ์ต๋๋ค.
rm ./package-lock.json
rm -rf ./node_modules
npm ์ค์น
์ด์ npm ์คํ ์คํ ๋ฆฌ ๋ถ ์ํ
ํ๋ฃจ๋ฅผ ๋ณด๋ธ ํ์ด ๋ฒ๊ทธ์ ๋ํ ๊ฒฝํ์ ๊ณต์ ํ๊ณ ์ถ์์ต๋๋ค.
๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ๋ ์ด๊ฒ์ ํฌํจํ์ฌ ์๋ง์ GH ๋ฌธ์ ์ค๋ ๋๋ฅผ ์ฝ์์ต๋๋ค. ๋ช ๊ฐ์ง ์ ์ ๋ ์์ ์ฌํญ์ ์๋ํด ๋ณด์์ง๋ง ํ๋๋ง "์ฉ์ธ ํ ์์๋"์ฑ๊ณต์ ๊ฑฐ๋์์ต๋๋ค.
๊ทธ ์ดํ๋ก์ด ๋ชจ๋ ๊ฒ์ ํ๊ณณ์ ๋ชจ์ผ๊ณ ์์ต๋๋ค. ๐
ํ๋ก์ ํธ ๋ฃจํธ์ ๊ธฐ์กด
.babelrc
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-modules-commonjs",
"@babel/plugin-transform-object-assign",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-transform-runtime"
],
"sourceRoot": "./"
}
๋ฃจํธ
.browserslistrc
last 2 versions
> 1%
IE >= 11
๊ด๋ จ์ฑ (๋๋ถ๋ถ)
package.json
"scripts": {
"build:storybook": "build-storybook --quiet -o ./dist/storybook",
"storybook": "start-storybook -p 6006"
},
"dependencies": {
"@babel/core": "7.3.4",
"@babel/plugin-proposal-class-properties": "7.3.4",
"@babel/plugin-proposal-optional-chaining": "7.7.5",
"@babel/plugin-transform-modules-commonjs": "7.2.0",
"@babel/plugin-transform-object-assign": "7.2.0",
"@babel/plugin-transform-runtime": "7.6.2",
"@babel/polyfill": "7.2.5",
"@babel/preset-env": "7.3.4",
"@babel/preset-react": "7.0.0",
"babel-loader": "8.0.6",
"react": "16.10.2",
"react-dom": "16.10.2",
"webpack": "4.43.0",
"webpack-cli": "3.3.11"
},
"devDependencies": {
"@storybook/addon-a11y": "5.3.19",
"@storybook/addon-actions": "5.3.19",
"@storybook/addon-docs": "5.3.19",
"@storybook/addon-knobs": "5.3.19",
"@storybook/addon-links": "5.3.19",
"@storybook/addons": "5.3.19",
"@storybook/react": "5.3.19",
"@storybook/source-loader": "5.3.19",
"acorn": "7.2.0",
"storybook-design-token": "0.7.3",
"webpack-dev-server": "3.10.3"
}
์์คํ
์ ๋ณด
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Shell: 5.0.2 - /usr/local/bin/bash (via homebrew)
Binaries:
Node: 10.18.0
npm: 6.13.4
Browsers:
Chrome: 86.0.4240.193
Firefox: 80.0.1
Safari: 14.0
useBuiltIns: 'usage'
์ ๋์
ํ์ต๋๋ค. ์ด์ ์๋ @babel/polyfill
์ ์๋ ๊ฐ์ ธ ์ค๊ธฐ๋ฅผ ์ฌ์ฉํ๊ณ useBuiltIns
์ ๊ธฐ๋ณธ๊ฐ์ ์ฌ์ฉํ์ต๋๋ค. ์ด ๋ณ๊ฒฝ ์ฌํญ์ด ๊ณง ๋ณํฉ ๋ ๊ฒ์ผ๋ก ์์ํฉ๋๋ค. ์ด๊ฒ์ด ๋ค๋ฅธ ๋ง์ ์ฌ๋๋ค์ด ์์ ์ฌํญ์ผ๋ก ์ ์ํ๊ณ ํ์ธํ๋ฏ์ด ํ์ฌ ๋ณ๊ฒฝ ์ฌํญ์ corejs๋ฅผ ์ข
์์ฑ์ผ๋ก ํฌํจ ํ ์ ์๊ฑฐ๋ ํฌํจํ์ง ์์ ์ฃผ๋ ์ด์ ์
๋๋ค..babelrc
(์ ์ฐธ์กฐ)๊ฐ ์์ต๋๋ค. ์ด ๊ตฌ์ฑ์ @babel/preset-env
๋ฅผ ์ฌ์ฉํ๊ณ ๋ฃจํธ .browserslistrc
(์ ์ฐธ์กฐ)๋ฅผ ์ฌ์ฉํ์ฌ polyfill ์ฌ์ฉ๋์ ๊ฒฐ์ ํฉ๋๋ค. ์ฑ์ ๋ฉ์ธ ๋ผ์ธ ๋ธ๋์น์๋ .storybook/.babelrc
๊ฐ ์์ต๋๋ค..js
์ฒ๋ฆฌ์ ๋ํ ํต์ฌ ๊ท์น์ ์์ ํ๋ ค๋ ์๋๋ฅผ ํฌ๊ธฐํ์ต๋๋ค.๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ ์ด๊ธฐ ์๋์ ๋๋ถ๋ถ์ ๋ฃจํธ .babelrc
(์ ์ฐธ์กฐ)์์ ์ต์
์ ์ค์ ํ์ฌ ๋ฐ๋ฒจ ( build-storybook
๋๊ตฌ๋ก ์คํ ๋จ)๊ณผ ์์ฌ ์ํต์ ์๋ํ๊ณ ์ํ๋ ๋ฐฉ์์ผ๋ก ์ ๋ฌํ๋ ๊ฒ์
๋๋ค. ๋ฐ์ํ๋ ํธ๋์ค ํ์ผ. ๋ค๋ฅธ ์ฌ์ฉ์๊ฐ ์ ์ํ useBuiltIns
, sourceType
๋ฑ์ ๊ตฌ์ฑ์ด ์ฑ๊ณตํ์ง ๋ชปํ์ต๋๋ค. ๋ํ ์ ์ฒด clean-npm-cache-remove-node-modules-and-package-lock-then-npm-install ๊ฒฝ๋ก๋ฅผ ์๋ฌด ์์ฉ์ด์์ด ์๋ํ์ต๋๋ค (๊ทธ _did_๋ก ์ธํด deps์ ์ผ๋ถ deps๊ฐ ์ฝ๊ฐ ๋ณ๊ฒฝ ๋๋๋ผ๋).
์ฒ์์๋ ์ฌ์ฉ์ ์ ์ .storybook/.babelrc
์ฌ์ฉํ๋ ๊ฒ์ ์ฃผ์ ํ์ง๋ง ์ต์
์ด ๋ถ์กฑํ์ต๋๋ค. ์ด์ ์ ํด๋น ํ์ผ์ ๋ง๋ค๊ณ extends
์์ฑ์ ํตํด ๋ฃจํธ .babelrc
์ ์กฐํ๋กญ๊ฒ ์๋ํ๋๋ก ์๋ํ์ง๋ง ๋ฒฝ์ ๋ถ๋ช ํ์ง๋ง ๋ค์ ์๋ํ๊ธฐ๋ก ๊ฒฐ์ ํ์ต๋๋ค.
๋ฃจํธ ๋ฐ๋ฒจ ๊ตฌ์ฑ์ ์คํ ๋ฆฌ ๋ถ ํน์ ๊ตฌ์ฑ์ผ๋ก ๊ฐ๋จํ๊ฒ ์ด๋ํ๋ฉด ์ ์ ์ฌ์ดํธ ๋น๋๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์๋ฃ ๋ ์ ์์์ง๋ง ์ฌ์ ํ ์๋ชป๋ ํธ๋์ค ํ์ผ์ ๋ํ๋ด๋ ๋ฐํ์ ์ค๋ฅ๊ฐ์์์ต๋๋ค (์ผ๋ถ ๊ฐ์ ธ ์ค๊ธฐ๋ฅผ ๋ค์ ๋ด ๋ณด๋ด๋ฉด ํด๋น ๊ฐ์ด undefined
์ต์ข
๊ฐ์ ธ ์ค๊ธฐ๊ฐ ์ ์ฅ๋๋ ํ์ผ). ์คํ ๋ฆฌ ๋ถ์ ํด๋ฆฌ ํ์ด ํ์ํ์ง ์๋ค๋ ๊ฒ์ ๊นจ๋ฌ์ ๊ธฐ ๋๋ฌธ์ ์๋ก์ด .storybook/.babelrc
์์ @babel/preset-env
์ฌ์ ์ค์ ์ ๋ชจ๋ ์ ๊ฑฐํ์ต๋๋ค. HUZZAH, ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค! ๊ทธ๋ฌ๋ ์๋ ๊ตฌ์ฑ์ ์ฑ์ ์ ์ง๋์ด์ผํ๊ธฐ ๋๋ฌธ์ ์ด๋ฆ์ .storybook/.babelrc-ci
ํ๊ณ ์๋ ๋ฃจํธ ๊ตฌ์ฑ์ ๋ณต์ํ์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ CI ํ์ดํ ๋ผ์ธ์ ์
๋ฐ์ดํธํ์ฌ CI ๊ตฌ์ฑ์ ํ์ธํ๊ณ ์ ์ ์ฌ์ดํธ ๋น๋ ์ ์ -ci
์ ๋ฏธ์ฌ๋ฅผ ์๋ผ๋ด๋๋ก ์ด๋ฆ์ ๋ณ๊ฒฝํด์ผํ์ง๋ง ์ด๋ ์ฌ์ํ ์ผ์ด์์ต๋๋ค.
์ด ํ๋ก์ธ์ค๋ก ์ธํด ๋ด ํจํค์ง์ ์ ๊ธ ํ์ผ์ ์์ฃผ ๊ฒ์ฌํ๊ฒ๋์๊ณ , ์คํ ๋ฆฌ ๋ถ v5.3.19์ ๋ชจ๋ ์ ๋์จ์ด corejs v3.xx, ๊ธฐ์กด @babel/polyfill
๋ฐ ๋ค๋ฅธ ๋ฐ๋ฒจ์ ๋ํ ์ข
์์ฑ์ด ์์์ ๋ฐ๊ฒฌํ์ต๋๋ค. deps๋ corejs v2.xx์ ์์กดํ์ต๋๋ค! ์ ์ด๋ ํ ๊ฐ์ง ๋ฌธ์ ๋ v2์ ๊ฐ์ฅ ๋ฎ์ ๊ณตํต ๋ถ๋ชจ๋ฅผ ์ฌ์ฉํ๋ ์ฑ์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ์ด๊ฒ์ ๋ด๊ฐ ๊ฒฝํ ํ ์ค๋ฅ๊ฐ es.array.iterator
์ ๊ฐ์ ๋ชจ๋์ ์ฐธ์กฐํ๊ณ v2๋ es6.array.iterator
์ ๊ฐ์ ๋ชจ๋์ ์ ๊ณตํ๊ธฐ ๋๋ฌธ์ ์๋ฏธ๊ฐ ์์ต๋๋ค. ์ด์ babel / corejs ๊ตฌ์ฑ์ ์ง์ํ๋ ๊ฒ์ ๋ชฉํ๋กํ๋ ๊ฒฝ์ฐ ์คํ ๋ฆฌ ๋ถ dep์ด ์ด๋ป๊ฒ ์ถฉ๋ํ๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ง๋ง ๊ทธ๋ด ๊ฒ ๊ฐ์ต๋๋ค. ๋ํ / all storybook-babel / installed babel / storybook-corejs / installed-corejs๊ฐ ๊ธฐ์กด .babelrc
์ฐพ๊ณ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ด์ฉ์ด ์์ด์ผํฉ๋๋ค. ๋ฃจํธ ๊ตฌ์ฑ์ ์คํ ๋ฆฌ ๋ถ๋ณ ๊ตฌ์ฑ์ผ๋ก ์ด๋ํ๋ฉด ๋ฌธ์ ๊ฐ ๋ง๋ฒ์ฒ๋ผ ํด๊ฒฐ๋๋ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. ์๋ง๋ ๊ฒฝ๋ก? ๐คทโโ๏ธ
์ด ๋ชจ๋ ๋ธ๋ ๋๋ง ํ์๋ ๊ผผ์ง๋ํ์ง ์์๋ค๋ฉด ์ถํํฉ๋๋ค! ๐
๋์ฒด๋ก์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ฐ์ด ๋ด๋ ค์ผํ๋ ๋๊ตฌ๋์ ๊ฐ๊ฒฉํ์ง๋ ์์ง๋ง ์๋ง๋ ๋ด ์ํฉ์ ๋ค์ ๋ ํนํฉ๋๋ค. ๋ํ ์์ ์ธ๊ธ ํ ๋ฐ๋ฒจ / ์นํฉ / ์คํ ๋ฆฌ ๋ถ ์ ๊ทธ๋ ์ด๋๊ฐ ํฉ์ณ์ง ํ์๋ ๋ชจ๋ ๋ฏ์ด ๋ผ ์์์ ๊ฒ์ ๋๋ค.
์ด์จ๋ ๊ฐ์ ๋ฌธ์ ๋ก ๊ณ ํต๋ฐ๋ ์ ์ด๋ ํ ์ฌ๋์๊ฒ ์ด๊ฒ์ด ํฅ๋ฏธ ๋ก์ ๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ๊ณ์ํด์ @shilman ๊ณผ @ndelangen ์ด์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ํฌ์ ํ ๊ฒ์ฒ๋ผ ํ๊ฒ ์ต๋๋ค . ๐
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋๋์ด ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์ต๊ทผ core-js @ 3 ์ ์ข ์์ฑ์ ์ถ๊ฐ ํ ์ต์ firebase๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
firebase๋ฅผ ์ ๊ทธ๋ ์ด๋ ํ ํ ์คํํ๋ ๋ฐ ์ฌ์ฉ ๋ ์คํ ๋ฆฌ ๋ถ์์ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.