@@ -23,7 +23,8 @@ export default defineConfig((options): Options[] => {
23
23
'react-redux' : 'src/index.ts' ,
24
24
} ,
25
25
sourcemap : true ,
26
- target : 'es2020' ,
26
+ clean : true ,
27
+ target : [ 'esnext' ] ,
27
28
tsconfig,
28
29
...options ,
29
30
}
@@ -32,67 +33,73 @@ export default defineConfig((options): Options[] => {
32
33
// Standard ESM, embedded `process.env.NODE_ENV` checks
33
34
{
34
35
...commonOptions ,
36
+ name : 'Modern ESM' ,
35
37
format : [ 'esm' ] ,
36
38
outExtension : ( ) => ( { js : '.mjs' } ) ,
37
39
dts : true ,
38
- clean : true ,
39
40
} ,
40
- // ESM for RSC
41
41
{
42
42
...commonOptions ,
43
+ name : 'ESM for RSC' ,
43
44
entry : {
44
45
rsc : 'src/index-rsc.ts' ,
45
46
} ,
46
47
format : [ 'esm' ] ,
47
48
outExtension : ( ) => ( { js : '.mjs' } ) ,
48
49
dts : false ,
49
50
} ,
51
+
50
52
// Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
53
+ // and optional chaining compiled away
51
54
{
52
55
...commonOptions ,
56
+ name : 'Legacy ESM, Webpack 4' ,
53
57
entry : {
54
58
'react-redux.legacy-esm' : 'src/index.ts' ,
55
59
} ,
56
- target : 'es2017' ,
60
+ target : [ 'es2017' ] ,
57
61
format : [ 'esm' ] ,
58
62
outExtension : ( ) => ( { js : '.js' } ) ,
59
63
} ,
60
- // Browser-ready ESM, production + minified
64
+
65
+ // Meant to be served up via CDNs like `unpkg`.
61
66
{
62
67
...commonOptions ,
68
+ name : 'Browser-ready ESM' ,
63
69
entry : {
64
70
'react-redux.browser' : 'src/index.ts' ,
65
71
} ,
72
+ platform : 'browser' ,
66
73
define : {
67
74
'process.env.NODE_ENV' : JSON . stringify ( 'production' ) ,
68
75
} ,
69
76
format : [ 'esm' ] ,
70
77
outExtension : ( ) => ( { js : '.mjs' } ) ,
71
78
minify : true ,
72
79
} ,
73
- // CJS development
74
80
{
75
81
...commonOptions ,
82
+ name : 'CJS Development' ,
76
83
entry : {
77
84
'react-redux.development' : 'src/index.ts' ,
78
85
} ,
79
86
define : {
80
87
'process.env.NODE_ENV' : JSON . stringify ( 'development' ) ,
81
88
} ,
82
- format : 'cjs' ,
89
+ format : [ 'cjs' ] ,
83
90
outDir : './dist/cjs/' ,
84
91
outExtension : ( ) => ( { js : '.cjs' } ) ,
85
92
} ,
86
- // CJS production
87
93
{
88
94
...commonOptions ,
95
+ name : 'CJS production' ,
89
96
entry : {
90
97
'react-redux.production.min' : 'src/index.ts' ,
91
98
} ,
92
99
define : {
93
100
'process.env.NODE_ENV' : JSON . stringify ( 'production' ) ,
94
101
} ,
95
- format : 'cjs' ,
102
+ format : [ 'cjs' ] ,
96
103
outDir : './dist/cjs/' ,
97
104
outExtension : ( ) => ( { js : '.cjs' } ) ,
98
105
minify : true ,
0 commit comments