Skip to content

Commit

Permalink
Generate bundle with all deps externalized
Browse files Browse the repository at this point in the history
This ensures that `classnames` and the like are imported from
node_modules rather than included in the bundle, allowing
consumers to more effectively dedupe their usage of these deps.
  • Loading branch information
mAAdhaTTah committed Aug 8, 2020
1 parent d6f6c4b commit 75bb90f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
"deploy-doc": "gh-pages -d demo"
},
"types": "./dist/index.d.ts",
"dependencies": {
"classnames": "^2.2.6",
"react-only-when": "^1.0.2",
"react-swipeable": "^5.5.1",
"resize-observer-polyfill": "1.5.0"
},
"peerDependencies": {
"prop-types": "^15.5.4",
"react": "^15.0.0 || ^16.0.0",
Expand Down Expand Up @@ -53,7 +59,6 @@
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^9.0.0",
"classnames": "^2.2.6",
"concurrently": "^4.1.0",
"cross-env": "^5.1.4",
"docz": "^2.3.0-alpha.6",
Expand All @@ -76,18 +81,16 @@
"prettier-eslint": "^8.8.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-only-when": "^1.0.2",
"react-resizable": "^1.7.5",
"react-scripts": "^2.1.8",
"react-test-renderer": "^16.5.2",
"resize-observer-polyfill": "1.5.0",
"rollup": "^0.64.1",
"rollup-plugin-alias": "^1.4.0",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-url": "^1.4.0",
"styled-components": "^5.1.0"
Expand All @@ -111,8 +114,5 @@
],
"resolutions": {
"ansi-styles": "^3.2.0"
},
"dependencies": {
"react-swipeable": "^5.5.1"
}
}
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import copy from "rollup-plugin-copy";
import external from 'rollup-plugin-peer-deps-external';
import external from "rollup-plugin-auto-external";
import postcss from 'rollup-plugin-postcss';
import resolve from 'rollup-plugin-node-resolve';
import url from 'rollup-plugin-url';
Expand Down
36 changes: 31 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4087,6 +4087,13 @@ builtin-status-codes@^3.0.0:
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=

builtins@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/builtins/-/builtins-2.0.1.tgz#42a4d6fe38973a7c185b435970d13e5e70f70f3c"
integrity sha512-XkkVe5QAb6guWPXTzpSrYpSlN3nqEmrrE2TkAr/tp7idSF6+MONh9WvKrAuR3HiKLvoSgmbs8l1U9IPmMrIoLw==
dependencies:
semver "^6.0.0"

[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
Expand Down Expand Up @@ -15550,6 +15557,15 @@ read-pkg@^2.0.0:
normalize-package-data "^2.3.2"
path-type "^2.0.0"

read-pkg@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389"
integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=
dependencies:
load-json-file "^4.0.0"
normalize-package-data "^2.3.2"
path-type "^3.0.0"

read-pkg@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"
Expand Down Expand Up @@ -16401,6 +16417,16 @@ rollup-plugin-alias@^1.4.0:
dependencies:
slash "^3.0.0"

rollup-plugin-auto-external@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-auto-external/-/rollup-plugin-auto-external-2.0.0.tgz#98fd137d66c1cbe0f4e245b31560a72dbde896aa"
integrity sha512-HQM3ZkZYfSam1uoZtAB9sK26EiAsfs1phrkf91c/YX+S07wugyRXSigBxrIwiLr5EPPilKYmoMxsrnlGBsXnuQ==
dependencies:
builtins "^2.0.0"
read-pkg "^3.0.0"
safe-resolve "^1.0.0"
semver "^5.5.0"

rollup-plugin-babel@^4.3.2:
version "4.4.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz#d15bd259466a9d1accbdb2fe2fff17c52d030acb"
Expand Down Expand Up @@ -16439,11 +16465,6 @@ rollup-plugin-node-resolve@^3.3.0:
is-module "^1.0.0"
resolve "^1.1.6"

rollup-plugin-peer-deps-external@^2.2.0:
version "2.2.3"
resolved "https://registry.yarnpkg.com/rollup-plugin-peer-deps-external/-/rollup-plugin-peer-deps-external-2.2.3.tgz#059a8aec1eefb48a475e9fcedc3b9e3deb521213"
integrity sha512-W6IePXTExGXVDAlfZbNUUrx3GxUOZP248u5n4a4ID1XZMrbQ+uGeNiEfapvdzwx0qZi5DNH/hDLiPUP+pzFIxg==

rollup-plugin-postcss@^1.6.2:
version "1.6.3"
resolved "https://registry.yarnpkg.com/rollup-plugin-postcss/-/rollup-plugin-postcss-1.6.3.tgz#18256ba66f29ecd9d42a68f4ef136b92b939ddb8"
Expand Down Expand Up @@ -16559,6 +16580,11 @@ safe-regex@^1.1.0:
dependencies:
ret "~0.1.10"

safe-resolve@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/safe-resolve/-/safe-resolve-1.0.0.tgz#fe34f8d29d7a3becfd249d0aa8a799b5c3cf6559"
integrity sha1-/jT40p16O+z9JJ0KqKeZtcPPZVk=

"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
Expand Down

0 comments on commit 75bb90f

Please sign in to comment.