Skip to content

Commit b5b2338

Browse files
committed
chore: update
1 parent 366365d commit b5b2338

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

tests/integration/umd-library-name/index.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test('correct read UMD name from CommonJS', async () => {
1313
version: '1.2.3',
1414
},
1515
};
16-
const context = vm.createContext({
16+
let context = vm.createContext({
1717
globalThis: mockGlobalThis,
1818
});
1919

@@ -22,10 +22,12 @@ test('correct read UMD name from CommonJS', async () => {
2222
// @ts-expect-error
2323
expect(await mockGlobalThis.MyLibrary.fn('ok')).toBe('DEBUG:1.2.3/ok');
2424

25+
context = vm.createContext({
26+
globalThis: mockGlobalThis,
27+
});
28+
2529
vm.runInContext(entries.umd1!, context);
2630

2731
// @ts-expect-error
28-
expect(await mockGlobalThis.MyLibrary1.MyLibrary2.fn('ok')).toBe(
29-
'DEBUG:1.2.3/ok',
30-
);
32+
expect(await mockGlobalThis.MyLibrary.Utils.fn('ok')).toBe('DEBUG:1.2.3/ok');
3133
});

tests/integration/umd-library-name/rslib.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default defineConfig({
1212
},
1313
}),
1414
generateBundleUmdConfig({
15-
umdName: ['MyLibrary1', 'MyLibrary2'],
15+
umdName: ['MyLibrary', 'Utils'],
1616
output: {
1717
distPath: {
1818
root: './dist/array',

website/docs/en/config/lib/umd-name.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ export default {
2626
};
2727
```
2828

29-
- Mount the UMD bundle to `global.MyLibrary1.MyLibrary2`.
29+
- Mount the UMD bundle to `global.MyLibrary.Utils`.
3030

3131
```ts title="rslib.config.ts"
3232
export default {
3333
lib: [
3434
{
3535
format: 'umd',
36-
umdName: ['MyLibrary1', 'MyLibrary2'], // [!code highlight]
36+
umdName: ['MyLibrary', 'Utils'], // [!code highlight]
3737
},
3838
],
3939
};

website/docs/zh/config/lib/umd-name.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ export default {
2626
};
2727
```
2828

29-
- 将 UMD 包挂载到 `global.MyLibrary1.MyLibrary2`
29+
- 将 UMD 包挂载到 `global.MyLibrary.Utils`
3030

3131
```ts title="rslib.config.ts"
3232
export default {
3333
lib: [
3434
{
3535
format: 'umd',
36-
umdName: ['MyLibrary1', 'MyLibrary2'], // [!code highlight]
36+
umdName: ['MyLibrary', 'Utils'], // [!code highlight]
3737
},
3838
],
3939
};

0 commit comments

Comments
 (0)