Skip to content

Commit

Permalink
build: Used vite-plugin-externals to externalize tanstack package
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Pinedo committed Nov 6, 2023
1 parent 30eaadc commit 1bd031d
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 20 deletions.
119 changes: 119 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"ts-node": "^10.9.1",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-plugin-externals": "^0.6.2",
"vite-tsconfig-paths": "^4.2.1",
"viz.js": "^2.1.2"
},
Expand Down
29 changes: 9 additions & 20 deletions packages/table/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
import { visualizer } from 'rollup-plugin-visualizer';
// Used from @storybook/react-vite dependencies
import react from '@vitejs/plugin-react';
import { viteExternalsPlugin } from 'vite-plugin-externals';

/** @type {import('vite').UserConfig} */
export default defineConfig({
Expand All @@ -13,26 +14,6 @@ export default defineConfig({
name: 'index',
fileName: 'index',
},
rollupOptions: {
external: [
'react',
'@devoinc/genesys-ui',
'styled-components',
'@tanstack/react-virtual',
'date-fns',
'date-fns-tz',
],
output: {
globals: {
react: 'React',
'styled-components': 'styled',
'@devoinc/genesys-ui': 'genesysUi',
'@tanstack/react-virtual': 'reactVirtual',
'date-fns': 'dateFns',
'date-fns-tz': 'dateFnsTz',
},
},
},
},
plugins: [
react({
Expand All @@ -53,5 +34,13 @@ export default defineConfig({
visualizer({
filename: 'dist/stats.html',
}),
viteExternalsPlugin({
react: 'React',
'styled-components': 'styled',
'@devoinc/genesys-ui': 'genesysUi',
'@tanstack/react-virtual': 'reactVirtual',
'date-fns': 'dateFns',
'date-fns-tz': 'dateFnsTz',
}),
],
});

0 comments on commit 1bd031d

Please sign in to comment.