Skip to content

Commit 40810d3

Browse files
committed
support module federation
1 parent 4edbf41 commit 40810d3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ module.exports = function nodeExternals(options) {
3030
utils.log(mistake.message);
3131
});
3232
}
33-
const allowlist = [].concat(options.allowlist || []);
33+
const webpackInternalAllowlist = [/^webpack\/container\/reference\//];
34+
const allowlist = []
35+
.concat(webpackInternalAllowlist)
36+
.concat(options.allowlist || []);
3437
const binaryDirs = [].concat(options.binaryDirs || ['.bin']);
3538
const importType = options.importType || 'commonjs';
3639
const modulesDir = options.modulesDir || 'node_modules';

test/library.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ describe('respects an allowlist', function() {
180180
it('when given a relative path', assertResult('./src/index.js', undefined));
181181
});
182182

183+
describe('should respect webpack 5 internal allowlist', function() {
184+
it('should ignore the specific path (empty callback)', assertResult('webpack/container/reference/', undefined));
185+
it('should invoke a commonjs callback', assertResult('moduleB', 'commonjs moduleB'));
186+
});
187+
183188
after(function(){
184189
restoreMock()
185190
});

0 commit comments

Comments
 (0)