@@ -97,18 +97,21 @@ const entryPoints: EntryPointOptions[] = [
97
97
folder : '' ,
98
98
entryPoint : 'src/index.ts' ,
99
99
extractionConfig : 'api-extractor.json' ,
100
+ globalName : 'RTK' ,
100
101
} ,
101
102
{
102
103
prefix : 'rtk-query' ,
103
104
folder : 'query' ,
104
105
entryPoint : 'src/query/index.ts' ,
105
106
extractionConfig : 'api-extractor.query.json' ,
107
+ globalName : 'RTKQ' ,
106
108
} ,
107
109
{
108
110
prefix : 'rtk-query-react' ,
109
111
folder : 'query/react' ,
110
112
entryPoint : 'src/query/react/index.ts' ,
111
113
extractionConfig : 'api-extractor.query-react.json' ,
114
+ globalName : 'RTKQ' ,
112
115
} ,
113
116
]
114
117
@@ -250,10 +253,7 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
250
253
/**
251
254
* since esbuild doesn't support umd, we use rollup to convert esm to umd
252
255
*/
253
- async function buildUMD ( outputPath : string , prefix : string ) {
254
- // All RTK UMD files share the same global variable name, regardless
255
- const globalName = 'RTK'
256
-
256
+ async function buildUMD ( outputPath : string , prefix : string , globalName : string ) {
257
257
for ( let umdExtension of [ 'umd' , 'umd.min' ] ) {
258
258
const input = path . join ( outputPath , `${ prefix } .${ umdExtension } .js` )
259
259
const instance = await rollup . rollup ( {
@@ -319,7 +319,7 @@ async function main({ skipExtraction = false, local = false }: BuildArgs) {
319
319
for ( let entryPoint of entryPoints ) {
320
320
const { folder } = entryPoint
321
321
const outputPath = path . join ( 'dist' , folder )
322
- await buildUMD ( outputPath , entryPoint . prefix )
322
+ await buildUMD ( outputPath , entryPoint . prefix , entryPoint . globalName )
323
323
}
324
324
325
325
// We need one additional package.json file in dist to support
0 commit comments