Skip to content

Commit

Permalink
fix(cli-bundler): browser ignore field should return empty object ins…
Browse files Browse the repository at this point in the history
…tead of undefined
  • Loading branch information
3cp committed Sep 8, 2020
1 parent 99cd678 commit 58d8355
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/build/stub-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const UNAVAIABLE_CORE_MODULES = [
'tls'
];

const EMPTY_MODULE = 'define(function(){});';
const EMPTY_MODULE = 'define(function(){return {};});';

function resolvePath(packageName, root) {
return path.relative(root, Utils.resolvePackagePath(packageName)).replace(/\\/g, '/');
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/build/stub-module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ describe('StubCoreNodejsModule', () => {
});

it('stubs empty module for some core module', () => {
expect(stubModule('dns', 'src')).toBe('define(function(){});');
expect(stubModule('dns', 'src')).toBe('define(function(){return {};});');
});

it('stubs empty module for __ignore__', () => {
expect(stubModule('__ignore__', 'src')).toBe('define(function(){});');
expect(stubModule('__ignore__', 'src')).toBe('define(function(){return {};});');
});
});

0 comments on commit 58d8355

Please sign in to comment.