Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 73d4f27

Browse files
committed
perf(rollup): correctly optimize build
1 parent f9856a4 commit 73d4f27

File tree

3 files changed

+21
-201
lines changed

3 files changed

+21
-201
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@
8080
},
8181
"dependencies": {
8282
"classnames": "^2.2.6",
83-
"emotion": "^9.2.6",
8483
"polished": "^1.9.3",
8584
"prop-types": "^15.6.2",
86-
"react-emotion": "^9.2.6",
8785
"react-transition-group": "^2.4.0",
8886
"recompact": "^3.3.0"
8987
},

rollup.config.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,25 @@ const cjsConfig = Object.assign({}, baseConfig, {
4545
],
4646
})
4747

48+
const globals = {
49+
react: 'React',
50+
'react-dom': 'ReactDom',
51+
'prop-types': 'PropTypes',
52+
'styled-components': 'styled',
53+
'react-transition-group/Transition': 'Transition',
54+
polished: 'polished',
55+
}
56+
4857
const umdConfig = Object.assign({}, baseConfig, {
4958
output: {
5059
name: 'smooth-ui',
5160
file: `${OUT_DIR}/dist/smooth-ui.js`,
52-
globals: {
53-
react: 'React',
54-
'react-dom': 'ReactDom',
55-
'styled-components': 'styled',
56-
},
5761
format: 'umd',
62+
globals,
63+
exports: 'named',
64+
sourcemap: true,
5865
},
66+
external: Object.keys(globals),
5967
plugins: [
6068
...baseConfig.plugins,
6169
resolve({ browser: true }),
@@ -64,22 +72,13 @@ const umdConfig = Object.assign({}, baseConfig, {
6472
],
6573
})
6674

67-
const minConfig = Object.assign({}, baseConfig, {
75+
const minConfig = Object.assign({}, baseConfig, umdConfig, {
6876
output: {
69-
name: 'smooth-ui',
77+
...umdConfig.output,
7078
file: `${OUT_DIR}/dist/smooth-ui.min.js`,
71-
globals: {
72-
react: 'React',
73-
'react-dom': 'ReactDom',
74-
'styled-components': 'styled',
75-
},
76-
format: 'umd',
7779
},
7880
plugins: [
79-
...baseConfig.plugins,
80-
resolve({ browser: true }),
81-
commonjs(),
82-
replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
81+
...umdConfig.plugins,
8382
uglify({
8483
compress: {
8584
pure_getters: true,

yarn.lock

Lines changed: 5 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,6 @@
166166
dependencies:
167167
"@babel/types" "7.0.0-rc.1"
168168

169-
170-
version "7.0.0-beta.51"
171-
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.51.tgz#ce00428045fbb7d5ebc0ea7bf835789f15366ab2"
172-
dependencies:
173-
"@babel/types" "7.0.0-beta.51"
174-
lodash "^4.17.5"
175-
176169
177170
version "7.0.0-beta.56"
178171
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.56.tgz#edf9494ef1f36674bb19cec9ea142b70f186406d"
@@ -701,14 +694,6 @@
701694
lodash "^4.2.0"
702695
to-fast-properties "^2.0.0"
703696

704-
705-
version "7.0.0-beta.51"
706-
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9"
707-
dependencies:
708-
esutils "^2.0.2"
709-
lodash "^4.17.5"
710-
to-fast-properties "^2.0.0"
711-
712697
713698
version "7.0.0-beta.56"
714699
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.56.tgz#df456947a82510ec30361971e566110d89489056"
@@ -725,52 +710,6 @@
725710
lodash "^4.17.10"
726711
to-fast-properties "^2.0.0"
727712

728-
"@emotion/babel-utils@^0.6.4":
729-
version "0.6.9"
730-
resolved "https://registry.yarnpkg.com/@emotion/babel-utils/-/babel-utils-0.6.9.tgz#bb074fadad65c443a575d3379488415fd194fc75"
731-
dependencies:
732-
"@emotion/hash" "^0.6.5"
733-
"@emotion/memoize" "^0.6.5"
734-
"@emotion/serialize" "^0.9.0"
735-
convert-source-map "^1.5.1"
736-
find-root "^1.1.0"
737-
source-map "^0.7.2"
738-
739-
"@emotion/hash@^0.6.2", "@emotion/hash@^0.6.5":
740-
version "0.6.5"
741-
resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.6.5.tgz#097729b84a5164f71f9acd2570ecfd1354d7b360"
742-
743-
"@emotion/is-prop-valid@^0.6.1":
744-
version "0.6.5"
745-
resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.6.5.tgz#25071b70957f250e7a8a543a9a187b09161f4d1c"
746-
dependencies:
747-
"@emotion/memoize" "^0.6.5"
748-
749-
"@emotion/memoize@^0.6.1", "@emotion/memoize@^0.6.5":
750-
version "0.6.5"
751-
resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.6.5.tgz#f868c314b889e7c3d84868a1d1cc323fbb40ca86"
752-
753-
"@emotion/serialize@^0.9.0":
754-
version "0.9.0"
755-
resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-0.9.0.tgz#ac5577cb98c7557c1a24a94cc101c5da6dc18322"
756-
dependencies:
757-
"@emotion/hash" "^0.6.5"
758-
"@emotion/memoize" "^0.6.5"
759-
"@emotion/unitless" "^0.6.6"
760-
"@emotion/utils" "^0.8.1"
761-
762-
"@emotion/stylis@^0.6.10":
763-
version "0.6.12"
764-
resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.12.tgz#3fb58220e0fc9e380bcabbb3edde396ddc1dfe6e"
765-
766-
"@emotion/unitless@^0.6.2", "@emotion/unitless@^0.6.6":
767-
version "0.6.6"
768-
resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.6.6.tgz#988957ecd0a9be00ee9de27172f8c56d41595a93"
769-
770-
"@emotion/utils@^0.8.1":
771-
version "0.8.1"
772-
resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.8.1.tgz#f3a81587ad8d0ef33cdad6f3b4310774fcc1053e"
773-
774713
"@sindresorhus/is@^0.7.0":
775714
version "0.7.0"
776715
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
@@ -1364,30 +1303,6 @@ babel-core@^6.0.0, babel-core@^6.26.0:
13641303
slash "^1.0.0"
13651304
source-map "^0.5.6"
13661305

1367-
babel-core@^6.26.3:
1368-
version "6.26.3"
1369-
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207"
1370-
dependencies:
1371-
babel-code-frame "^6.26.0"
1372-
babel-generator "^6.26.0"
1373-
babel-helpers "^6.24.1"
1374-
babel-messages "^6.23.0"
1375-
babel-register "^6.26.0"
1376-
babel-runtime "^6.26.0"
1377-
babel-template "^6.26.0"
1378-
babel-traverse "^6.26.0"
1379-
babel-types "^6.26.0"
1380-
babylon "^6.18.0"
1381-
convert-source-map "^1.5.1"
1382-
debug "^2.6.9"
1383-
json5 "^0.5.1"
1384-
lodash "^4.17.4"
1385-
minimatch "^3.0.4"
1386-
path-is-absolute "^1.0.1"
1387-
private "^0.1.8"
1388-
slash "^1.0.0"
1389-
source-map "^0.5.7"
1390-
13911306
babel-core@^7.0.0-0:
13921307
version "7.0.0-bridge.0"
13931308
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
@@ -1444,24 +1359,6 @@ babel-messages@^6.23.0:
14441359
dependencies:
14451360
babel-runtime "^6.22.0"
14461361

1447-
babel-plugin-emotion@^9.2.6:
1448-
version "9.2.6"
1449-
resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-9.2.6.tgz#992d48f316c20610c28a95ae90e6bd193014eec5"
1450-
dependencies:
1451-
"@babel/helper-module-imports" "7.0.0-beta.51"
1452-
"@emotion/babel-utils" "^0.6.4"
1453-
"@emotion/hash" "^0.6.2"
1454-
"@emotion/memoize" "^0.6.1"
1455-
"@emotion/stylis" "^0.6.10"
1456-
babel-core "^6.26.3"
1457-
babel-plugin-macros "^2.0.0"
1458-
babel-plugin-syntax-jsx "^6.18.0"
1459-
convert-source-map "^1.5.0"
1460-
find-root "^1.1.0"
1461-
mkdirp "^0.5.1"
1462-
source-map "^0.5.7"
1463-
touch "^1.0.0"
1464-
14651362
babel-plugin-istanbul@^4.1.6:
14661363
version "4.1.6"
14671364
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45"
@@ -1475,16 +1372,6 @@ babel-plugin-jest-hoist@^23.2.0:
14751372
version "23.2.0"
14761373
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.2.0.tgz#e61fae05a1ca8801aadee57a6d66b8cefaf44167"
14771374

1478-
babel-plugin-macros@^2.0.0:
1479-
version "2.4.0"
1480-
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.4.0.tgz#6c5f9836e1f6c0a9743b3bab4af29f73e437e544"
1481-
dependencies:
1482-
cosmiconfig "^5.0.5"
1483-
1484-
babel-plugin-syntax-jsx@^6.18.0:
1485-
version "6.18.0"
1486-
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
1487-
14881375
babel-plugin-syntax-object-rest-spread@^6.13.0:
14891376
version "6.13.0"
14901377
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
@@ -2673,7 +2560,7 @@ conventional-recommended-bump@^1.0.0:
26732560
meow "^3.3.0"
26742561
object-assign "^4.0.1"
26752562

2676-
convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1:
2563+
convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0:
26772564
version "1.5.1"
26782565
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5"
26792566

@@ -2725,39 +2612,13 @@ [email protected], core-util-is@~1.0.0:
27252612
version "1.0.2"
27262613
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
27272614

2728-
cosmiconfig@^5.0.5:
2729-
version "5.0.6"
2730-
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39"
2731-
dependencies:
2732-
is-directory "^0.3.1"
2733-
js-yaml "^3.9.0"
2734-
parse-json "^4.0.0"
2735-
27362615
create-ecdh@^4.0.0:
27372616
version "4.0.0"
27382617
resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d"
27392618
dependencies:
27402619
bn.js "^4.1.0"
27412620
elliptic "^6.0.0"
27422621

2743-
create-emotion-styled@^9.2.6:
2744-
version "9.2.6"
2745-
resolved "https://registry.yarnpkg.com/create-emotion-styled/-/create-emotion-styled-9.2.6.tgz#25be44a298e6e49d833ecf2247836284dc9c2042"
2746-
dependencies:
2747-
"@emotion/is-prop-valid" "^0.6.1"
2748-
2749-
create-emotion@^9.2.6:
2750-
version "9.2.6"
2751-
resolved "https://registry.yarnpkg.com/create-emotion/-/create-emotion-9.2.6.tgz#f64cf1c64cf82fe7d22725d1d77498ddd2d39edb"
2752-
dependencies:
2753-
"@emotion/hash" "^0.6.2"
2754-
"@emotion/memoize" "^0.6.1"
2755-
"@emotion/stylis" "^0.6.10"
2756-
"@emotion/unitless" "^0.6.2"
2757-
csstype "^2.5.2"
2758-
stylis "^3.5.0"
2759-
stylis-rule-sheet "^0.0.10"
2760-
27612622
create-hash@^1.1.0, create-hash@^1.1.2:
27622623
version "1.1.3"
27632624
resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd"
@@ -2958,10 +2819,6 @@ [email protected], "cssom@>= 0.3.2 < 0.4.0":
29582819
dependencies:
29592820
cssom "0.3.x"
29602821

2961-
csstype@^2.5.2:
2962-
version "2.5.6"
2963-
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.5.6.tgz#2ae1db2319642d8b80a668d2d025c6196071e788"
2964-
29652822
currently-unhandled@^0.4.1:
29662823
version "0.4.1"
29672824
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"
@@ -3003,7 +2860,7 @@ dateformat@^3.0.0:
30032860
version "3.0.3"
30042861
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
30052862

3006-
[email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9:
2863+
[email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.6, debug@^2.6.8:
30072864
version "2.6.9"
30082865
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
30092866
dependencies:
@@ -3353,13 +3210,6 @@ emojis-list@^2.0.0:
33533210
version "2.1.0"
33543211
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
33553212

3356-
emotion@^9.2.6:
3357-
version "9.2.6"
3358-
resolved "https://registry.yarnpkg.com/emotion/-/emotion-9.2.6.tgz#48517515e769bca6d8f7ff18425a7f133b010f22"
3359-
dependencies:
3360-
babel-plugin-emotion "^9.2.6"
3361-
create-emotion "^9.2.6"
3362-
33633213
encodeurl@~1.0.1:
33643214
version "1.0.1"
33653215
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20"
@@ -4030,10 +3880,6 @@ find-cache-dir@^1.0.0:
40303880
make-dir "^1.0.0"
40313881
pkg-dir "^2.0.0"
40323882

4033-
find-root@^1.1.0:
4034-
version "1.1.0"
4035-
resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4"
4036-
40373883
find-up@^1.0.0:
40383884
version "1.1.2"
40393885
resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f"
@@ -5699,7 +5545,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
56995545
version "3.0.2"
57005546
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
57015547

5702-
js-yaml@^3.11.0, js-yaml@^3.9.0:
5548+
js-yaml@^3.11.0:
57035549
version "3.12.0"
57045550
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
57055551
dependencies:
@@ -6603,12 +6449,6 @@ nopt@^4.0.1:
66036449
abbrev "1"
66046450
osenv "^0.1.4"
66056451

6606-
nopt@~1.0.10:
6607-
version "1.0.10"
6608-
resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee"
6609-
dependencies:
6610-
abbrev "1"
6611-
66126452
normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5:
66136453
version "2.4.0"
66146454
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f"
@@ -7428,7 +7268,7 @@ prettycli@^1.4.3:
74287268
dependencies:
74297269
chalk "2.1.0"
74307270

7431-
private@^0.1.6, private@^0.1.7, private@^0.1.8, private@~0.1.5:
7271+
private@^0.1.6, private@^0.1.7, private@~0.1.5:
74327272
version "0.1.8"
74337273
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
74347274

@@ -7726,13 +7566,6 @@ react-dom@^16.4.2:
77267566
object-assign "^4.1.1"
77277567
prop-types "^15.6.0"
77287568

7729-
react-emotion@^9.2.6:
7730-
version "9.2.6"
7731-
resolved "https://registry.yarnpkg.com/react-emotion/-/react-emotion-9.2.6.tgz#3941f78779f9a8ad8300042ddfa9b2cb111442c2"
7732-
dependencies:
7733-
babel-plugin-emotion "^9.2.6"
7734-
create-emotion-styled "^9.2.6"
7735-
77367569
react-error-overlay@^4.0.0:
77377570
version "4.0.0"
77387571
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-4.0.0.tgz#d198408a85b4070937a98667f500c832f86bd5d4"
@@ -8837,18 +8670,14 @@ source-map@^0.4.4:
88378670
dependencies:
88388671
amdefine ">=0.0.4"
88398672

8840-
source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1, source-map@~0.5.6:
8673+
source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.6:
88418674
version "0.5.7"
88428675
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
88438676

88448677
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
88458678
version "0.6.1"
88468679
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
88478680

8848-
source-map@^0.7.2:
8849-
version "0.7.3"
8850-
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
8851-
88528681
sparkles@^1.0.0:
88538682
version "1.0.0"
88548683
resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3"
@@ -9347,12 +9176,6 @@ to-regex@^3.0.1, to-regex@^3.0.2:
93479176
regex-not "^1.0.2"
93489177
safe-regex "^1.1.0"
93499178

9350-
touch@^1.0.0:
9351-
version "1.0.0"
9352-
resolved "https://registry.yarnpkg.com/touch/-/touch-1.0.0.tgz#449cbe2dbae5a8c8038e30d71fa0ff464947c4de"
9353-
dependencies:
9354-
nopt "~1.0.10"
9355-
93569179
tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.0, tough-cookie@~2.3.3:
93579180
version "2.3.3"
93589181
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561"

0 commit comments

Comments
 (0)