Skip to content

Commit 942d14c

Browse files
committed
Don't pull in all of core-js with core (#1601)
1 parent 32717c7 commit 942d14c

File tree

6 files changed

+84
-87
lines changed

6 files changed

+84
-87
lines changed

packages/core/babel.config.js

+8-31
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
const BABEL_ENV = process.env.BABEL_ENV;
2-
3-
const defaultPlugins = [
4-
'@babel/plugin-proposal-class-properties',
5-
'@babel/plugin-proposal-object-rest-spread',
6-
'@babel/plugin-proposal-optional-chaining',
7-
// IE 11 support
8-
'@babel/plugin-transform-object-assign'
9-
];
2+
const IS_TEST = BABEL_ENV === "test"
103

114
module.exports = {
125
presets: [
@@ -15,30 +8,14 @@ module.exports = {
158
{
169
modules: ["cjs", "test"].includes(BABEL_ENV) ? "commonjs" : false,
1710
targets:
18-
BABEL_ENV === "test" ? { node: "current" } : { browsers: "defaults" },
11+
IS_TEST ? { node: "current" } : { browsers: "defaults" },
1912
},
2013
],
21-
"@babel/preset-react",
14+
"@babel/preset-react"
15+
],
16+
plugins: [
17+
"@babel/plugin-proposal-class-properties",
18+
"@babel/plugin-proposal-optional-chaining"
2219
],
23-
env: {
24-
cjs: {
25-
plugins: defaultPlugins,
26-
ignore: ['test/**/*.js']
27-
},
28-
umd: {
29-
plugins: defaultPlugins,
30-
ignore: ['test/**/*.js']
31-
},
32-
es: {
33-
plugins: [
34-
...defaultPlugins,
35-
['@babel/plugin-transform-runtime', { useESModules: true, corejs: 2 }]
36-
],
37-
ignore: ['test/**/*.js']
38-
},
39-
test: {
40-
plugins: defaultPlugins,
41-
ignore: []
42-
}
43-
},
20+
ignore: IS_TEST ? [] : ['test/**/*.js'],
4421
};

packages/core/package-lock.json

+69-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@
4242
"react": ">=16"
4343
},
4444
"dependencies": {
45-
"@babel/runtime-corejs2": "^7.8.7",
4645
"@types/json-schema": "^7.0.4",
4746
"ajv": "^6.7.0",
48-
"core-js": "^2.5.7",
47+
"core-js-pure": "^3.6.5",
4948
"json-schema-merge-allof": "^0.6.0",
5049
"jsonpointer": "^4.0.1",
5150
"lodash": "^4.17.15",
@@ -58,11 +57,9 @@
5857
"@babel/cli": "^7.4.4",
5958
"@babel/core": "^7.4.5",
6059
"@babel/plugin-proposal-class-properties": "^7.4.4",
61-
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
6260
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
6361
"@babel/plugin-transform-object-assign": "^7.8.3",
6462
"@babel/plugin-transform-react-jsx": "^7.3.0",
65-
"@babel/plugin-transform-runtime": "^7.4.4",
6663
"@babel/preset-env": "^7.4.5",
6764
"@babel/preset-react": "^7.0.0",
6865
"@babel/register": "^7.4.4",

packages/core/src/components/fields/ArrayField.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import AddButton from "../AddButton";
22
import IconButton from "../IconButton";
33
import React, { Component } from "react";
4-
import includes from "core-js/library/fn/array/includes";
4+
import includes from "core-js-pure/es/array/includes";
55
import * as types from "../../types";
66

77
import {

packages/core/src/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import * as ReactIs from "react-is";
33
import mergeAllOf from "json-schema-merge-allof";
4-
import fill from "core-js/library/fn/array/fill";
4+
import fill from "core-js-pure/es/array/fill";
55
import validateFormData, { isValid } from "./validate";
66
import union from "lodash/union";
77
import jsonpointer from "jsonpointer";

packages/core/webpack.config.dist.js

+4-19
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,17 @@ module.exports = {
2525
})
2626
],
2727
devtool: "source-map",
28-
externals: {
29-
react: {
30-
root: "React",
31-
commonjs: "react",
32-
commonjs2: "react",
33-
amd: "react"
34-
},
35-
'react-dom': {
36-
root: "ReactDOM",
37-
commonjs2: 'react-dom',
38-
commonjs: 'react-dom',
39-
amd: 'react-dom',
40-
umd: 'react-dom',
41-
}
42-
},
28+
externals: [
29+
'react',
30+
'react-dom'
31+
],
4332
module: {
4433
rules: [
4534
{
4635
test: /\.js$/,
4736
use: [
4837
"babel-loader",
4938
],
50-
exclude: [
51-
path.join(__dirname, "node_modules", "core-js"),
52-
path.join(__dirname, "node_modules", "babel-runtime"),
53-
],
5439
},
5540
]
5641
}

0 commit comments

Comments
 (0)