This repository was archived by the owner on Dec 22, 2024. It is now read-only.
File tree 2 files changed +16
-4
lines changed
2 files changed +16
-4
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" : {
58
- "react" : " ^17.0.0" ,
59
- "react-dom" : " ^17.0.0"
57
+ "dependencies" : {},
58
+ "peerDependencies" : {
59
+ "@emotion/react" : " ^11.9.0" ,
60
+ "react" : " ^17.0.0 || ^18.0.0" ,
61
+ "react-dom" : " ^17.0.0 || ^18.0.0"
60
62
},
61
63
"devDependencies" : {
62
64
"@babel/core" : " 7.18.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,17 +20,19 @@ export default defineConfig({
12
20
fileName : ( format ) => `react-vite-storybook-typescript-starter.${ format } .js` ,
13
21
} ,
14
22
rollupOptions : {
15
- external : [ 'react' ] ,
23
+ external : makeExternalPredicate ( [ ... Object . keys ( packageJson . dependencies ) , ... Object . keys ( packageJson . peerDependencies ) ] ) ,
16
24
output : {
17
25
globals : {
18
26
react : 'React' ,
27
+ '@emotion/react' : '@emotion/react' ,
19
28
} ,
20
29
} ,
21
30
} ,
22
31
} ,
23
32
plugins : [
24
33
react ( {
25
34
jsxImportSource : '@emotion/react' ,
35
+ exclude : [ / \. s t o r i e s \. ( t | j ) s x ? $ / , / n o d e _ m o d u l e s / ] ,
26
36
babel : {
27
37
plugins : [ '@emotion/babel-plugin' ] ,
28
38
} ,
You can’t perform that action at this time.
0 commit comments