Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Replace preset-env polyfills with babel-polyfills #13055

Merged
merged 15 commits into from
Dec 1, 2020
Merged
3 changes: 2 additions & 1 deletion app/react/src/server/framework-preset-react.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ describe('framework-preset-react', () => {
describe('babel', () => {
it('should return a config with fast refresh plugin when fast refresh is enabled', async () => {
const config = await preset.babel(babelConfigMock, storybookOptions as StorybookOptions);
const plugins = config.plugins || [];

expect(config.plugins).toEqual([reactRefreshPath]);
expect(plugins[0]).toContain(reactRefreshPath);
});

it('should return unchanged config without fast refresh plugin when fast refresh is disabled', async () => {
Expand Down
2 changes: 1 addition & 1 deletion app/react/src/server/framework-preset-react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ export async function webpackFinal(config: Configuration, options: StorybookOpti

return {
...config,
plugins: [...(config.plugins || []), new ReactRefreshWebpackPlugin()],
plugins: [...config.plugins, new ReactRefreshWebpackPlugin()],
};
}
1 change: 1 addition & 0 deletions lib/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"babel-loader": "^8.0.6",
"babel-plugin-emotion": "^10.0.20",
"babel-plugin-macros": "^2.8.0",
"babel-plugin-polyfill-corejs3": "^0.0.7",
"babel-preset-minify": "^0.5.0 || 0.6.0-alpha.5",
"better-opn": "^2.0.0",
"boxen": "^4.1.0",
Expand Down
14 changes: 10 additions & 4 deletions lib/core/src/server/common/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ export const plugins = [
*/
require.resolve('@babel/plugin-proposal-optional-chaining'),
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
[
require.resolve('babel-plugin-polyfill-corejs3'),
{
method: 'usage-global',
absoluteImports: require.resolve('core-js'),
// eslint-disable-next-line global-require
version: require('core-js/package.json').version,
},
],
];

export const presets = [
[
require.resolve('@babel/preset-env'),
{ shippedProposals: true, useBuiltIns: 'usage', corejs: '3' },
],
[require.resolve('@babel/preset-env'), { shippedProposals: true }],
require.resolve('@babel/preset-typescript'),
];

Expand Down
4 changes: 0 additions & 4 deletions scripts/run-e2e-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ export const sfcVue: Parameters = {
name: 'sfcVue',
version: 'latest',
generator: fromDeps('vue', 'vue-loader', 'vue-template-compiler', 'webpack@webpack-4'),
additionalDeps: [
// TODO: remove when https://github.com/storybookjs/storybook/issues/11255 is solved
'core-js',
43081j marked this conversation as resolved.
Show resolved Hide resolved
],
};

export const svelte: Parameters = {
Expand Down
71 changes: 68 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,20 @@
"@babel/types" "^7.8.3"
lodash "^4.17.13"

"@babel/helper-define-polyfill-provider@^0.0.5":
version "0.0.5"
resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.0.5.tgz#a800224db85c562db2f31a1a6fe6e93d25b7b8d1"
integrity sha512-SjyoYnKgK5fXyIx9X5Fa02cCXJtkp17t0iQeSv0cKu3/rDhcA2DszStwx3ugFy+mdZeTm24ZwlDU1n3/LSN6Cg==
dependencies:
"@babel/helper-compilation-targets" "^7.10.4"
"@babel/helper-module-imports" "^7.10.4"
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/traverse" "^7.11.5"
debug "^4.1.1"
lodash.debounce "^4.0.8"
resolve "^1.14.2"
semver "^6.1.2"

"@babel/helper-explode-assignable-expression@^7.10.4":
version "7.11.4"
resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.11.4.tgz#2d8e3470252cc17aba917ede7803d4a7a276a41b"
Expand Down Expand Up @@ -9150,6 +9164,14 @@ babel-plugin-named-asset-import@^0.3.1, babel-plugin-named-asset-import@^0.3.2,
resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.6.tgz#c9750a1b38d85112c9e166bf3ef7c5dbc605f4be"
integrity sha512-1aGDUfL1qOOIoqk9QKGIo2lANk+C7ko/fqH0uIyC71x3PEGz0uVP8ISgfEsFuG+FKmjHTvFK/nNM8dowpmUxLA==

babel-plugin-polyfill-corejs3@^0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.0.7.tgz#624aa59510c2db41df5b79de1d304b9b05e565ef"
integrity sha512-aCTLXh9sTc+ZC3GFi1buLDkmXGaeenTzGZjXcD5b3Zqf1xhgoW4vX6H0QZUGW/u9QjKPafeiZSkaiVjL/U1uzg==
dependencies:
"@babel/helper-define-polyfill-provider" "^0.0.5"
core-js-compat "^3.7.0"

babel-plugin-react-docgen@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-react-docgen/-/babel-plugin-react-docgen-4.1.0.tgz#1dfa447dac9ca32d625a123df5733a9e47287c26"
Expand Down Expand Up @@ -10876,6 +10898,16 @@ browserslist@^4.0.0, browserslist@^4.1.0, browserslist@^4.1.1, browserslist@^4.1
node-releases "^1.1.53"
pkg-up "^2.0.0"

browserslist@^4.14.6:
version "4.14.6"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.14.6.tgz#97702a9c212e0c6b6afefad913d3a1538e348457"
integrity sha512-zeFYcUo85ENhc/zxHbiIp0LGzzTrE2Pv2JhxvS7kpUb9Q9D38kUX6Bie7pGutJ/5iF5rOxE7CepAuWD56xJ33A==
dependencies:
caniuse-lite "^1.0.30001154"
electron-to-chromium "^1.3.585"
escalade "^3.1.1"
node-releases "^1.1.65"

browserstack@^1.5.1:
version "1.6.0"
resolved "https://registry.yarnpkg.com/browserstack/-/browserstack-1.6.0.tgz#5a56ab90987605d9c138d7a8b88128370297f9bf"
Expand Down Expand Up @@ -11406,9 +11438,14 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000939, can
integrity sha512-PFTw9UyVfbkcMEFs82q8XVlRayj7HKvnhu5BLcmjGpv+SNyiWasCcWXPGJuO0rK0dhLRDJmtZcJ+LHUfypbw1w==

caniuse-lite@^1.0.30001109:
version "1.0.30001156"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001156.tgz#75c20937b6012fe2b02ab58b30d475bf0718de97"
integrity sha512-z7qztybA2eFZTB6Z3yvaQBIoJpQtsewRD74adw2UbRWwsRq3jIPvgrQGawBMbfafekQaD21FWuXNcywtTDGGCw==
version "1.0.30001161"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001161.tgz#64f7ffe79ee780b8c92843ff34feb36cea4651e0"
integrity sha512-JharrCDxOqPLBULF9/SPa6yMcBRTjZARJ6sc3cuKrPfyIk64JN6kuMINWqA99Xc8uElMFcROliwtz0n9pYej+g==

caniuse-lite@^1.0.30001154:
version "1.0.30001157"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001157.tgz#2d11aaeb239b340bc1aa730eca18a37fdb07a9ab"
integrity sha512-gOerH9Wz2IRZ2ZPdMfBvyOi3cjaz4O4dgNwPGzx8EhqAs4+2IL/O+fJsbt+znSigujoZG8bVcIAUM/I/E5K3MA==

canonical-path@1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -12687,6 +12724,14 @@ core-js-compat@^3.6.2, core-js-compat@^3.6.4:
browserslist "^4.8.5"
semver "7.0.0"

core-js-compat@^3.7.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.7.0.tgz#8479c5d3d672d83f1f5ab94cf353e57113e065ed"
integrity sha512-V8yBI3+ZLDVomoWICO6kq/CD28Y4r1M7CWeO4AGpMdMfseu8bkSubBmUPySMGKRTS+su4XQ07zUkAsiu9FCWTg==
dependencies:
browserslist "^4.14.6"
semver "7.0.0"

core-js-pure@^3.0.0, core-js-pure@^3.0.1:
version "3.6.5"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813"
Expand Down Expand Up @@ -14459,6 +14504,11 @@ electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.378, electron-to-chromi
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.452.tgz#ef6877702722471aa044a2429336cd450629934d"
integrity sha512-IdbjgCEqDvcU/1kUQa6C49I2NZOY3SBmU9Eus7mdFdJJBqn0Lg1Epfi/T4nqVcxTNBEGhcjwMhY1EysMBsXZrw==

electron-to-chromium@^1.3.585:
version "1.3.591"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.591.tgz#a18892bf1acb93f7b6e4da402705d564bc235017"
integrity sha512-ol/0WzjL4NS4Kqy9VD6xXQON91xIihDT36sYCew/G/bnd1v0/4D+kahp26JauQhgFUjrdva3kRSo7URcUmQ+qw==

elegant-spinner@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e"
Expand Down Expand Up @@ -15416,6 +15466,11 @@ es6-symbol@^3.1.1, es6-symbol@~3.1.1, es6-symbol@~3.1.3:
d "^1.0.1"
ext "^1.1.2"

escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==

escape-goat@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/escape-goat/-/escape-goat-2.1.1.tgz#1b2dc77003676c457ec760b2dc68edb648188675"
Expand Down Expand Up @@ -23301,6 +23356,11 @@ lodash.debounce@^3.1.1:
dependencies:
lodash._getnative "^3.0.0"

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=

lodash.defaultsdeep@^4.6.0, lodash.defaultsdeep@^4.6.1:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6"
Expand Down Expand Up @@ -25159,6 +25219,11 @@ node-releases@^1.1.29, node-releases@^1.1.52, node-releases@^1.1.53:
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.56.tgz#bc054a417d316e3adac90eafb7e1932802f28705"
integrity sha512-EVo605FhWLygH8a64TjgpjyHYOihkxECwX1bHHr8tETJKWEiWS2YJjPbvsX2jFjnjTNEgBCmk9mLjKG1Mf11cw==

node-releases@^1.1.65:
version "1.1.66"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.66.tgz#609bd0dc069381015cd982300bae51ab4f1b1814"
integrity sha512-JHEQ1iWPGK+38VLB2H9ef2otU4l8s3yAMt9Xf934r6+ojCYDMHPMqvCc9TnzfeFSP1QEOeU6YZEd3+De0LTCgg==

node-sass@^4.12.0, node-sass@^4.14.0:
version "4.14.1"
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.14.1.tgz#99c87ec2efb7047ed638fb4c9db7f3a42e2217b5"
Expand Down