mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(zone.js): correctly bundle zone-patch-rxjs (#55826)
https://github.com/angular/angular/pull/53443 caused the a local `rxjs` file to be imported from an entry-point which caused this to be excluded from being bundled due to the name matching `rxjs`. Closes #55825 PR Close #55826
This commit is contained in:
@@ -54,6 +54,19 @@ const banner = `'use strict';
|
||||
*/`;
|
||||
|
||||
module.exports = {
|
||||
external: (id) => {
|
||||
if (id[0] === '.') {
|
||||
// Relative paths are always non external.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/zone\.js[\\/]lib/.test(id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return /rxjs|electron/.test(id);
|
||||
},
|
||||
|
||||
plugins: [
|
||||
node({
|
||||
mainFields: ['es2015', 'module', 'jsnext:main', 'main'],
|
||||
@@ -61,13 +74,6 @@ module.exports = {
|
||||
commonjs(),
|
||||
stripBannerPlugin,
|
||||
],
|
||||
external: (id) => {
|
||||
if (/zone\.js[\\/]lib/.test(id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return /rxjs|^electron/.test(id);
|
||||
},
|
||||
output: {
|
||||
globals: {
|
||||
electron: 'electron',
|
||||
|
||||
@@ -116,6 +116,13 @@ describe('Zone.js npm_package', () => {
|
||||
expect(shx.cat('zone.js')).toMatch(/^\s*'use strict';/);
|
||||
});
|
||||
});
|
||||
|
||||
it('zone-patch-rxjs.js should have rxjs external', () => {
|
||||
checkInSubFolder('./fesm2015', () => {
|
||||
expect(shx.cat('zone-patch-rxjs.js')).toContain(` from 'rxjs'`);
|
||||
expect(shx.cat('zone-patch-rxjs.js')).toContain(`Zone.__load_patch('rxjs',`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('bundles file list', () => {
|
||||
|
||||
Reference in New Issue
Block a user