@@ -81,22 +81,42 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
8181 return [
8282 {
8383 ...commonOptions ,
84- name : 'Redux-Toolkit-ESM' ,
84+ name : 'Redux-Toolkit-Core- ESM' ,
8585 entry : {
8686 'redux-toolkit.modern' : 'src/index.ts' ,
87+ } ,
88+ outExtension : ( ) => ( { js : '.mjs' } ) ,
89+ format : [ 'esm' ] ,
90+ } ,
91+ {
92+ ...commonOptions ,
93+ name : 'Redux-Toolkit-Nested-ESM' ,
94+ external : commonOptions . external . concat ( '@reduxjs/toolkit' ) ,
95+ entry : {
8796 'react/redux-toolkit-react.modern' : 'src/react/index.ts' ,
8897 'query/rtk-query.modern' : 'src/query/index.ts' ,
8998 'query/react/rtk-query-react.modern' : 'src/query/react/index.ts' ,
9099 } ,
91100 outExtension : ( ) => ( { js : '.mjs' } ) ,
92101 format : [ 'esm' ] ,
93102 } ,
94-
95103 {
96104 ...commonOptions ,
97- name : 'Redux-Toolkit-CJS-Development' ,
105+ name : 'Redux-Toolkit-Core- CJS-Development' ,
98106 entry : {
99107 'cjs/redux-toolkit.development' : 'src/index.ts' ,
108+ } ,
109+ outExtension : ( ) => ( { js : '.cjs' } ) ,
110+ env : {
111+ NODE_ENV : 'development' ,
112+ } ,
113+ format : [ 'cjs' ] ,
114+ } ,
115+ {
116+ ...commonOptions ,
117+ name : 'Redux-Toolkit-Nested-CJS-Development' ,
118+ external : commonOptions . external . concat ( '@reduxjs/toolkit' ) ,
119+ entry : {
100120 'react/cjs/redux-toolkit-react.development' : 'src/react/index.ts' ,
101121 'query/cjs/rtk-query.development' : 'src/query/index.ts' ,
102122 'query/react/cjs/rtk-query-react.development' :
@@ -108,16 +128,11 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
108128 } ,
109129 format : [ 'cjs' ] ,
110130 } ,
111-
112131 {
113132 ...commonOptions ,
114- name : 'Redux-Toolkit-CJS-Production' ,
133+ name : 'Redux-Toolkit-Core- CJS-Production' ,
115134 entry : {
116135 'cjs/redux-toolkit.production.min' : 'src/index.ts' ,
117- 'react/cjs/redux-toolkit-react.production.min' : 'src/react/index.ts' ,
118- 'query/cjs/rtk-query.production.min' : 'src/query/index.ts' ,
119- 'query/react/cjs/rtk-query-react.production.min' :
120- 'src/query/react/index.ts' ,
121136 } ,
122137 outExtension : ( ) => ( { js : '.cjs' } ) ,
123138 env : {
@@ -131,7 +146,27 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
131146 path . join ( import . meta. dirname , 'dist' , 'cjs' ) ,
132147 'redux-toolkit' ,
133148 )
149+ } ,
150+ } ,
134151
152+ {
153+ ...commonOptions ,
154+ name : 'Redux-Toolkit-Nested-CJS-Production' ,
155+ external : commonOptions . external . concat ( '@reduxjs/toolkit' ) ,
156+ entry : {
157+ 'react/cjs/redux-toolkit-react.production.min' : 'src/react/index.ts' ,
158+ 'query/cjs/rtk-query.production.min' : 'src/query/index.ts' ,
159+ 'query/react/cjs/rtk-query-react.production.min' :
160+ 'src/query/react/index.ts' ,
161+ } ,
162+ outExtension : ( ) => ( { js : '.cjs' } ) ,
163+ env : {
164+ NODE_ENV : 'production' ,
165+ } ,
166+ minify : true ,
167+ replaceNodeEnv : true ,
168+ format : [ 'cjs' ] ,
169+ onSuccess : async ( ) => {
135170 await writeCommonJSEntry (
136171 path . join ( import . meta. dirname , 'dist' , 'react' , 'cjs' ) ,
137172 'redux-toolkit-react' ,
@@ -151,9 +186,28 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
151186
152187 {
153188 ...commonOptions ,
154- name : 'Redux-Toolkit-Browser' ,
189+ name : 'Redux-Toolkit-Core- Browser' ,
155190 entry : {
156191 'redux-toolkit.browser' : 'src/index.ts' ,
192+ } ,
193+ outExtension : ( ) => ( { js : '.mjs' } ) ,
194+ platform : 'browser' ,
195+ env : {
196+ NODE_ENV : 'production' ,
197+ } ,
198+ minify : true ,
199+ define : {
200+ process : 'undefined' ,
201+ } ,
202+ replaceNodeEnv : true ,
203+ format : [ 'esm' ] ,
204+ } ,
205+
206+ {
207+ ...commonOptions ,
208+ name : 'Redux-Toolkit-Nested-Browser' ,
209+ external : commonOptions . external . concat ( '@reduxjs/toolkit' ) ,
210+ entry : {
157211 'react/redux-toolkit-react.browser' : 'src/react/index.ts' ,
158212 'query/rtk-query.browser' : 'src/query/index.ts' ,
159213 'query/react/rtk-query-react.browser' : 'src/query/react/index.ts' ,
@@ -170,12 +224,27 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
170224 replaceNodeEnv : true ,
171225 format : [ 'esm' ] ,
172226 } ,
173-
174227 {
175228 ...commonOptions ,
176- name : 'Redux-Toolkit-Legacy-ESM' ,
229+ name : 'Redux-Toolkit-Core- Legacy-ESM' ,
177230 entry : {
178231 'redux-toolkit.legacy-esm' : 'src/index.ts' ,
232+ } ,
233+ outExtension : ( ) => ( { js : '.js' } ) ,
234+ format : [ 'esm' ] ,
235+ target : [ 'es2017' ] ,
236+ onSuccess : async ( ) => {
237+ await fs . copyFile (
238+ path . join ( import . meta. dirname , 'src' , 'uncheckedindexed.ts' ) ,
239+ path . join ( outputDir , 'uncheckedindexed.ts' ) ,
240+ )
241+ } ,
242+ } ,
243+ {
244+ ...commonOptions ,
245+ name : 'Redux-Toolkit-Nexted-Legacy-ESM' ,
246+ external : commonOptions . external . concat ( '@reduxjs/toolkit' ) ,
247+ entry : {
179248 'react/redux-toolkit-react.legacy-esm' : 'src/react/index.ts' ,
180249 'query/rtk-query.legacy-esm' : 'src/query/index.ts' ,
181250 'query/react/rtk-query-react.legacy-esm' : 'src/query/react/index.ts' ,
0 commit comments