File tree Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 5454 "coverage" : " vitest --coverage" ,
5555 "upgrade-interactive" : " npm-check -u"
5656 },
57+ "dependencies" : {},
5758 "peerDependencies" : {
5859 "@emotion/react" : " ^11.9.0" ,
5960 "react" : " ^17.0.0 || ^18.0.0" ,
Original file line number Diff line number Diff line change @@ -3,6 +3,14 @@ import react from '@vitejs/plugin-react';
33import dts from 'vite-plugin-dts' ;
44import packageJson from './package.json' ;
55
6+ const makeExternalPredicate = ( externals : string [ ] ) => {
7+ if ( externals . length === 0 ) {
8+ return ( ) => false ;
9+ }
10+ const pattern = new RegExp ( `^(${ externals . join ( '|' ) } )($|/)` ) ;
11+ return ( id : string ) => pattern . test ( id ) ;
12+ } ;
13+
614// https://vitejs.dev/config/
715export default defineConfig ( {
816 build : {
@@ -12,20 +20,10 @@ export default defineConfig({
1220 fileName : ( format ) => `react-section-dividers.${ format } .js` ,
1321 } ,
1422 rollupOptions : {
15- external : [
16- 'react' ,
17- 'react-dom' ,
18- '@emotion/cache' ,
19- '@emotion/hash' ,
20- '@emotion/is-prop-valid' ,
21- '@emotion/memoize' ,
22- '@emotion/react' ,
23- '@emotion/serialize' ,
24- '@emotion/styled' ,
25- '@emotion/styled/base' ,
26- '@emotion/unitless' ,
27- '@emotion/utils' ,
28- ] ,
23+ external : makeExternalPredicate ( [
24+ ...Object . keys ( packageJson . dependencies ) ,
25+ ...Object . keys ( packageJson . peerDependencies )
26+ ] ) ,
2927 output : {
3028 globals : {
3129 react : 'React' ,
You can’t perform that action at this time.
0 commit comments