Skip to content

Commit b20c629

Browse files
refactor: code
1 parent 1c4e8bd commit b20c629

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function resolveExposes(item) {
22
let result;
33

44
if (typeof item === 'string') {
5-
const splittedItem = item.split(' ');
5+
const splittedItem = item.split('|');
66

77
if (splittedItem.length > 2) {
88
throw new Error(`Invalid "${item}" for expose`);

test/__snapshots__/loader.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ exports[`loader should be different modules id: warnings 1`] = `Array []`;
3434
exports[`loader should emit error because of many arguments: errors 1`] = `
3535
Array [
3636
"ModuleBuildError: Module build failed (from \`replaced original path\`):
37-
Error: Invalid \\"myGlobal_alias globalObject6 excessArgument\\" for expose",
37+
Error: Invalid \\"myGlobal_alias|globalObject6|excessArgument\\" for expose",
3838
]
3939
`;
4040

test/fixtures/inline-import-2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import myExports from '../../src/cjs.js?exposes=myGlobal!./simple-commonjs2-single-export.js';
2-
import myExports2 from '../../src/cjs.js?exposes[]=myOtherGlobal.globalObject2%20globalObject2&exposes[]=myOtherGlobal.globalObject3%20globalObject3!./simple-commonjs2-multiple-export.js';
2+
import myExports2 from '../../src/cjs.js?exposes[]=myOtherGlobal.globalObject2|globalObject2&exposes[]=myOtherGlobal.globalObject3|globalObject3!./simple-commonjs2-multiple-export.js';
33

44
export { myExports, myExports2 };

test/fixtures/inline-import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import myExports from '../../src/cjs.js?exposes=myGlobal%20default!./custom.js?foo=bar';
1+
import myExports from '../../src/cjs.js?exposes=myGlobal|default!./custom.js?foo=bar';
22

33
export default myExports;

test/loader.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('loader', () => {
4848

4949
it('should work multiple commonjs exports', async () => {
5050
const compiler = getCompiler('simple-commonjs2-multiple-export.js', {
51-
exposes: ['myOtherGlobal', 'myGlobal.globalObject2 globalObject2'],
51+
exposes: ['myOtherGlobal', 'myGlobal.globalObject2|globalObject2'],
5252
});
5353
const stats = await compile(compiler);
5454

@@ -80,7 +80,7 @@ describe('loader', () => {
8080

8181
it('should work for nested properties for a global object', async () => {
8282
const compiler = getCompiler('simple-commonjs2-single-export.js', {
83-
exposes: ['myGlobal.nested', 'myOtherGlobal.nested foo'],
83+
exposes: ['myGlobal.nested', 'myOtherGlobal.nested|foo'],
8484
});
8585
const stats = await compile(compiler);
8686

@@ -113,9 +113,9 @@ describe('loader', () => {
113113
it('should work string config', async () => {
114114
const compiler = getCompiler('simple-module-named-export.js', {
115115
exposes: [
116-
'myGlobal_alias.globalObject6 globalObject6',
117-
'myGlobal_alias.globalObject7 globalObject7',
118-
'myGlobal_alias.default default',
116+
'myGlobal_alias.globalObject6|globalObject6',
117+
'myGlobal_alias.globalObject7|globalObject7',
118+
'myGlobal_alias.default|default',
119119
'myGlobal',
120120
'myOtherGlobal',
121121
],
@@ -162,7 +162,7 @@ describe('loader', () => {
162162
globalName: ['myGlobal_alias', 'globalObject7'],
163163
localName: 'globalObject7',
164164
},
165-
'myGlobal_alias.default default',
165+
'myGlobal_alias.default|default',
166166
],
167167
});
168168
const stats = await compile(compiler);
@@ -264,7 +264,7 @@ describe('loader', () => {
264264
const stats = await compile(compiler);
265265

266266
const webpack4Filename = 'main-b0db002e.bundle.js';
267-
const webpack5Filename = 'main-effaed92.bundle.js';
267+
const webpack5Filename = 'main-22966fe7.bundle.js';
268268
const bundleName =
269269
webpack.version[0] === '5' ? webpack5Filename : webpack4Filename;
270270

@@ -312,7 +312,7 @@ describe('loader', () => {
312312

313313
it('should emit error because of many arguments', async () => {
314314
const compiler = getCompiler('simple-module-named-export.js', {
315-
exposes: ['myGlobal_alias globalObject6 excessArgument'],
315+
exposes: ['myGlobal_alias|globalObject6|excessArgument'],
316316
});
317317
const stats = await compile(compiler);
318318

0 commit comments

Comments
 (0)