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 54
54
"coverage" : " vitest --coverage" ,
55
55
"upgrade-interactive" : " npm-check -u"
56
56
},
57
+ "dependencies" : {},
57
58
"peerDependencies" : {
58
59
"@emotion/react" : " ^11.9.0" ,
59
60
"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';
3
3
import dts from 'vite-plugin-dts' ;
4
4
import packageJson from './package.json' ;
5
5
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
+
6
14
// https://vitejs.dev/config/
7
15
export default defineConfig ( {
8
16
build : {
@@ -12,20 +20,10 @@ export default defineConfig({
12
20
fileName : ( format ) => `react-section-dividers.${ format } .js` ,
13
21
} ,
14
22
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
+ ] ) ,
29
27
output : {
30
28
globals : {
31
29
react : 'React' ,
You can’t perform that action at this time.
0 commit comments