Skip to content

Commit 7e95349

Browse files
committed
chore: move deps used at runtime in peer dependencies, mark external
1 parent 13542f6 commit 7e95349

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

esbuild.config.prod.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as esbuild from 'esbuild'
22
import cssModulesPlugin from 'esbuild-css-modules-plugin'
33
import fs from 'fs'
4+
import pkg from './package.json' assert { type: 'json' }
45

56
const buildsConfig = [
67
{
@@ -44,6 +45,7 @@ const buildsConfig = [
4445
minify: true,
4546
},
4647
]
48+
const externals = Object.keys({ ...(pkg.peerDependencies ?? {}), ...(pkg.dependencies ?? {}) })
4749

4850
const builds = await Promise.all(
4951
buildsConfig.map(({ format, outfile, minify }) =>
@@ -55,7 +57,7 @@ const builds = await Promise.all(
5557
treeShaking: true,
5658
minify,
5759
sourcemap: true,
58-
external: ['react', 'react-dom', 'prop-types'],
60+
external: externals,
5961
plugins: [
6062
cssModulesPlugin({
6163
// inject: true,

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
},
3737
"homepage": "https://github.com/ReactTooltip/react-tooltip#readme",
3838
"devDependencies": {
39+
"@floating-ui/dom": "^1.0.0",
3940
"@rollup/plugin-commonjs": "22.0.2",
4041
"@rollup/plugin-node-resolve": "14.1.0",
4142
"@rollup/plugin-replace": "4.0.0",
@@ -52,6 +53,7 @@
5253
"@typescript-eslint/eslint-plugin": "5.54.0",
5354
"@typescript-eslint/parser": "5.54.0",
5455
"bundlesize": "^0.18.1",
56+
"classnames": "^2.3.0",
5557
"css-loader": "6.7.3",
5658
"esbuild": "0.17.11",
5759
"esbuild-css-modules-plugin": "^2.7.1",
@@ -71,7 +73,7 @@
7173
"postcss": "8.4.21",
7274
"prettier": "2.8.4",
7375
"process": "^0.11.10",
74-
"prop-types": "^15.7.2",
76+
"prop-types": ">=15.0.0",
7577
"react": "16.14.0",
7678
"react-dom": "16.14.0",
7779
"rimraf": "^3.0.2",
@@ -96,6 +98,9 @@
9698
"typescript": "4.9.5"
9799
},
98100
"peerDependencies": {
101+
"@floating-ui/dom": "^1.0.0",
102+
"classnames": "^2.3.0",
103+
"prop-types": ">=15.0.0",
99104
"react": ">=16.14.0",
100105
"react-dom": ">=16.14.0"
101106
},
@@ -110,9 +115,5 @@
110115
"last 1 firefox version",
111116
"last 1 safari version"
112117
]
113-
},
114-
"dependencies": {
115-
"@floating-ui/dom": "1.2.3",
116-
"classnames": "^2.3.2"
117118
}
118119
}

0 commit comments

Comments
 (0)