refactor(deps): replace d3-color with empty object

This commit is contained in:
moklick
2022-05-16 19:37:35 +02:00
parent 1eee0cd377
commit 6ec76d2d58
4 changed files with 2210 additions and 6 deletions
+2192 -5
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -1,6 +1,6 @@
{
"name": "react-flow-renderer",
"version": "10.2.2",
"version": "10.2.3-next.0",
"engines": {
"node": ">=14"
},
@@ -61,6 +61,7 @@
"@babel/preset-env": "^7.17.10",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.2.1",
@@ -81,6 +82,7 @@
"release-it": "^14.14.3",
"rimraf": "^3.0.2",
"rollup": "^2.71.0",
"rollup-plugin-filesize": "^9.1.2",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-serve": "^1.1.0",
+6
View File
@@ -7,6 +7,8 @@ import typescript from 'rollup-plugin-typescript2';
import { DEFAULT_EXTENSIONS as DEFAULT_BABEL_EXTENSIONS } from '@babel/core';
import { visualizer } from 'rollup-plugin-visualizer';
import { terser } from 'rollup-plugin-terser';
import filesize from 'rollup-plugin-filesize';
import alias from '@rollup/plugin-alias';
import pkg from './package.json';
@@ -76,6 +78,9 @@ export const baseConfig = ({ outputOptions = {}, injectCSS = true } = {}) => {
output,
plugins: [
alias({
entries: [{ find: 'd3-color', replacement: __dirname + '/src/d3-color-alias' }],
}),
replace({
__ENV__: JSON.stringify(processEnv),
__REACT_FLOW_VERSION__: JSON.stringify(pkg.version),
@@ -100,6 +105,7 @@ export const baseConfig = ({ outputOptions = {}, injectCSS = true } = {}) => {
babelHelpers: 'runtime',
}),
visualizer(),
filesize(),
!isEsm && terser(),
],
};
+9
View File
@@ -0,0 +1,9 @@
// this helps us to reduce bundle size by ~10kb. d3-color is not used but can't be treeshaked in this case.
const obj = {};
export const rgb = {};
export const color = {};
export const hsl = {};
export const lab = {};
export const hcl = {};
export const cubehelix = {};
export default obj;