Skip to content

Commit ec20bbf

Browse files
committed
Upgrade Rollup build process
1 parent 069c9c1 commit ec20bbf

File tree

3 files changed

+284
-83
lines changed

3 files changed

+284
-83
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@
6161
"object-is": "^1.1.2"
6262
},
6363
"devDependencies": {
64+
"@ampproject/rollup-plugin-closure-compiler": "^0.25.2",
6465
"@babel/core": "^7.9.0",
6566
"@babel/plugin-transform-flow-strip-types": "^7.9.0",
6667
"@babel/plugin-transform-object-assign": "^7.8.3",
6768
"@babel/preset-env": "^7.9.5",
6869
"@babel/preset-flow": "^7.9.0",
6970
"@babel/preset-react": "^7.9.4",
71+
"@rollup/plugin-buble": "^0.21.3",
72+
"@rollup/plugin-commonjs": "^11.1.0",
73+
"@rollup/plugin-node-resolve": "^7.1.3",
7074
"babel-plugin-closure-elimination": "^1.3.0",
7175
"babel-plugin-transform-async-to-promises": "^0.8.15",
7276
"codecov": "^3.6.5",
@@ -81,9 +85,6 @@
8185
"react-is": "^16.13.1",
8286
"rollup": "^2.6.1",
8387
"rollup-plugin-babel": "^4.4.0",
84-
"rollup-plugin-buble": "^0.19.8",
85-
"rollup-plugin-commonjs": "^10.1.0",
86-
"rollup-plugin-node-resolve": "^5.2.0",
8788
"rollup-plugin-replace": "^2.2.0",
8889
"rollup-plugin-terser": "^5.3.0"
8990
}

rollup.config.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import commonjs from 'rollup-plugin-commonjs'
2-
import nodeResolve from 'rollup-plugin-node-resolve'
3-
import buble from 'rollup-plugin-buble'
1+
import commonjs from '@rollup/plugin-commonjs'
2+
import nodeResolve from '@rollup/plugin-node-resolve'
3+
import buble from '@rollup/plugin-buble'
44
import babel from 'rollup-plugin-babel'
55
import { terser } from 'rollup-plugin-terser'
6+
import compiler from '@ampproject/rollup-plugin-closure-compiler'
67
import replace from 'rollup-plugin-replace'
78

89
const pkgInfo = require('./package.json')
@@ -19,7 +20,7 @@ if (pkgInfo.dependencies) {
1920
}
2021

2122
const externalPredicate = new RegExp(`^(${external.join('|')})($|/)`)
22-
const externalTest = id => {
23+
const externalTest = (id) => {
2324
if (id === 'babel-plugin-transform-async-to-promises/helpers') {
2425
return false
2526
}
@@ -117,6 +118,10 @@ const makePlugins = (isProduction = false) => [
117118
replace({
118119
'process.env.NODE_ENV': JSON.stringify('production')
119120
}),
121+
isProduction &&
122+
compiler({
123+
compilation_level: 'SIMPLE_OPTIMIZATIONS'
124+
}),
120125
isProduction ? terserMinified : terserPretty
121126
]
122127

0 commit comments

Comments
 (0)