@@ -81,22 +81,42 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
81
81
return [
82
82
{
83
83
...commonOptions ,
84
- name : 'Redux-Toolkit-ESM' ,
84
+ name : 'Redux-Toolkit-Core- ESM' ,
85
85
entry : {
86
86
'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 : {
87
96
'react/redux-toolkit-react.modern' : 'src/react/index.ts' ,
88
97
'query/rtk-query.modern' : 'src/query/index.ts' ,
89
98
'query/react/rtk-query-react.modern' : 'src/query/react/index.ts' ,
90
99
} ,
91
100
outExtension : ( ) => ( { js : '.mjs' } ) ,
92
101
format : [ 'esm' ] ,
93
102
} ,
94
-
95
103
{
96
104
...commonOptions ,
97
- name : 'Redux-Toolkit-CJS-Development' ,
105
+ name : 'Redux-Toolkit-Core- CJS-Development' ,
98
106
entry : {
99
107
'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 : {
100
120
'react/cjs/redux-toolkit-react.development' : 'src/react/index.ts' ,
101
121
'query/cjs/rtk-query.development' : 'src/query/index.ts' ,
102
122
'query/react/cjs/rtk-query-react.development' :
@@ -108,16 +128,11 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
108
128
} ,
109
129
format : [ 'cjs' ] ,
110
130
} ,
111
-
112
131
{
113
132
...commonOptions ,
114
- name : 'Redux-Toolkit-CJS-Production' ,
133
+ name : 'Redux-Toolkit-Core- CJS-Production' ,
115
134
entry : {
116
135
'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' ,
121
136
} ,
122
137
outExtension : ( ) => ( { js : '.cjs' } ) ,
123
138
env : {
@@ -131,7 +146,27 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
131
146
path . join ( import . meta. dirname , 'dist' , 'cjs' ) ,
132
147
'redux-toolkit' ,
133
148
)
149
+ } ,
150
+ } ,
134
151
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 ( ) => {
135
170
await writeCommonJSEntry (
136
171
path . join ( import . meta. dirname , 'dist' , 'react' , 'cjs' ) ,
137
172
'redux-toolkit-react' ,
@@ -151,9 +186,28 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
151
186
152
187
{
153
188
...commonOptions ,
154
- name : 'Redux-Toolkit-Browser' ,
189
+ name : 'Redux-Toolkit-Core- Browser' ,
155
190
entry : {
156
191
'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 : {
157
211
'react/redux-toolkit-react.browser' : 'src/react/index.ts' ,
158
212
'query/rtk-query.browser' : 'src/query/index.ts' ,
159
213
'query/react/rtk-query-react.browser' : 'src/query/react/index.ts' ,
@@ -170,12 +224,27 @@ export default defineConfig((overrideOptions): TsupOptions[] => {
170
224
replaceNodeEnv : true ,
171
225
format : [ 'esm' ] ,
172
226
} ,
173
-
174
227
{
175
228
...commonOptions ,
176
- name : 'Redux-Toolkit-Legacy-ESM' ,
229
+ name : 'Redux-Toolkit-Core- Legacy-ESM' ,
177
230
entry : {
178
231
'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 : {
179
248
'react/redux-toolkit-react.legacy-esm' : 'src/react/index.ts' ,
180
249
'query/rtk-query.legacy-esm' : 'src/query/index.ts' ,
181
250
'query/react/rtk-query-react.legacy-esm' : 'src/query/react/index.ts' ,
0 commit comments