@@ -23,7 +23,8 @@ export default defineConfig((options): Options[] => {
2323 'react-redux' : 'src/index.ts' ,
2424 } ,
2525 sourcemap : true ,
26- target : 'es2020' ,
26+ clean : true ,
27+ target : [ 'esnext' ] ,
2728 tsconfig,
2829 ...options ,
2930 }
@@ -32,67 +33,73 @@ export default defineConfig((options): Options[] => {
3233 // Standard ESM, embedded `process.env.NODE_ENV` checks
3334 {
3435 ...commonOptions ,
36+ name : 'Modern ESM' ,
3537 format : [ 'esm' ] ,
3638 outExtension : ( ) => ( { js : '.mjs' } ) ,
3739 dts : true ,
38- clean : true ,
3940 } ,
40- // ESM for RSC
4141 {
4242 ...commonOptions ,
43+ name : 'ESM for RSC' ,
4344 entry : {
4445 rsc : 'src/index-rsc.ts' ,
4546 } ,
4647 format : [ 'esm' ] ,
4748 outExtension : ( ) => ( { js : '.mjs' } ) ,
4849 dts : false ,
4950 } ,
51+
5052 // Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
53+ // and optional chaining compiled away
5154 {
5255 ...commonOptions ,
56+ name : 'Legacy ESM, Webpack 4' ,
5357 entry : {
5458 'react-redux.legacy-esm' : 'src/index.ts' ,
5559 } ,
56- target : 'es2017' ,
60+ target : [ 'es2017' ] ,
5761 format : [ 'esm' ] ,
5862 outExtension : ( ) => ( { js : '.js' } ) ,
5963 } ,
60- // Browser-ready ESM, production + minified
64+
65+ // Meant to be served up via CDNs like `unpkg`.
6166 {
6267 ...commonOptions ,
68+ name : 'Browser-ready ESM' ,
6369 entry : {
6470 'react-redux.browser' : 'src/index.ts' ,
6571 } ,
72+ platform : 'browser' ,
6673 define : {
6774 'process.env.NODE_ENV' : JSON . stringify ( 'production' ) ,
6875 } ,
6976 format : [ 'esm' ] ,
7077 outExtension : ( ) => ( { js : '.mjs' } ) ,
7178 minify : true ,
7279 } ,
73- // CJS development
7480 {
7581 ...commonOptions ,
82+ name : 'CJS Development' ,
7683 entry : {
7784 'react-redux.development' : 'src/index.ts' ,
7885 } ,
7986 define : {
8087 'process.env.NODE_ENV' : JSON . stringify ( 'development' ) ,
8188 } ,
82- format : 'cjs' ,
89+ format : [ 'cjs' ] ,
8390 outDir : './dist/cjs/' ,
8491 outExtension : ( ) => ( { js : '.cjs' } ) ,
8592 } ,
86- // CJS production
8793 {
8894 ...commonOptions ,
95+ name : 'CJS production' ,
8996 entry : {
9097 'react-redux.production.min' : 'src/index.ts' ,
9198 } ,
9299 define : {
93100 'process.env.NODE_ENV' : JSON . stringify ( 'production' ) ,
94101 } ,
95- format : 'cjs' ,
102+ format : [ 'cjs' ] ,
96103 outDir : './dist/cjs/' ,
97104 outExtension : ( ) => ( { js : '.cjs' } ) ,
98105 minify : true ,
0 commit comments