Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9dd370c

Browse files
petermikitsherikras
authored andcommitted
Externalize babel helpers using @babel/runtime (#60)
* Externalize babel helpers using @babel/runtime * [package-lock.json] restore dev flags
1 parent 1754789 commit 9dd370c

File tree

4 files changed

+66
-52
lines changed

4 files changed

+66
-52
lines changed

‎.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"plugins": [
2323
"@babel/plugin-transform-flow-strip-types",
24+
"@babel/plugin-transform-runtime",
2425
"@babel/plugin-syntax-dynamic-import",
2526
"@babel/plugin-syntax-import-meta",
2627
"@babel/plugin-proposal-class-properties",

‎package-lock.json

Lines changed: 44 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
3737
"@babel/plugin-syntax-import-meta": "^7.0.0",
3838
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
39+
"@babel/plugin-transform-runtime": "^7.2.0",
3940
"@babel/preset-env": "^7.0.0",
41+
"@babel/preset-flow": "^7.0.0",
4042
"@babel/preset-react": "^7.0.0",
4143
"@types/react": "^16.4.16",
4244
"babel-core": "^7.0.0-bridge.0",
@@ -75,8 +77,7 @@
7577
"rollup-plugin-node-resolve": "^3.4.0",
7678
"rollup-plugin-replace": "^2.1.0",
7779
"rollup-plugin-uglify": "^6.0.0",
78-
"typescript": "^3.1.3",
79-
"@babel/preset-flow": "^7.0.0"
80+
"typescript": "^3.1.3"
8081
},
8182
"peerDependencies": {
8283
"final-form": ">=4.0.0",
@@ -112,6 +113,7 @@
112113
}
113114
],
114115
"dependencies": {
116+
"@babel/runtime": "^7.2.0",
115117
"react-lifecycles-compat": "^3.0.4"
116118
}
117119
}

‎rollup.config.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,20 @@ export default {
4949
},
5050
output
5151
),
52-
external: [
53-
'react',
54-
'prop-types',
55-
'final-form',
56-
'react-final-form',
57-
'react-lifecycles-compat'
58-
],
52+
external: id => {
53+
const externals = [
54+
'react',
55+
'prop-types',
56+
'final-form',
57+
'react-final-form',
58+
'react-lifecycles-compat'
59+
]
60+
61+
const isBabelRuntime = id.startsWith('@babel/runtime')
62+
const isStaticExternal = externals.indexOf(id) > -1
63+
64+
return isBabelRuntime || isStaticExternal
65+
},
5966
plugins: [
6067
resolve({ jsnext: true, main: true }),
6168
flow(),
@@ -76,6 +83,7 @@ export default {
7683
],
7784
plugins: [
7885
'@babel/plugin-transform-flow-strip-types',
86+
'@babel/plugin-transform-runtime',
7987
'@babel/plugin-syntax-dynamic-import',
8088
'@babel/plugin-syntax-import-meta',
8189
'@babel/plugin-proposal-class-properties',
@@ -90,7 +98,8 @@ export default {
9098
'@babel/plugin-proposal-export-namespace-from',
9199
'@babel/plugin-proposal-numeric-separator',
92100
'@babel/plugin-proposal-throw-expressions'
93-
]
101+
],
102+
runtimeHelpers: true
94103
}),
95104
umd
96105
? replace({

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /