Skip to content

Commit 20a530a

Browse files
alan-agius4atscott
authored andcommitted
fix(zone.js): correctly bundle zone-patch-rxjs (#55826)
#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
1 parent f3b0e2f commit 20a530a

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

packages/zone.js/rollup.config.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,26 @@ const banner = `'use strict';
5454
*/`;
5555

5656
module.exports = {
57+
external: (id) => {
58+
if (id[0] === '.') {
59+
// Relative paths are always non external.
60+
return false;
61+
}
62+
63+
if (/zone\.js[\\/]lib/.test(id)) {
64+
return false;
65+
}
66+
67+
return /rxjs|electron/.test(id);
68+
},
69+
5770
plugins: [
5871
node({
5972
mainFields: ['es2015', 'module', 'jsnext:main', 'main'],
6073
}),
6174
commonjs(),
6275
stripBannerPlugin,
6376
],
64-
external: (id) => {
65-
if (/zone\.js[\\/]lib/.test(id)) {
66-
return false;
67-
}
68-
69-
return /rxjs|^electron/.test(id);
70-
},
7177
output: {
7278
globals: {
7379
electron: 'electron',

packages/zone.js/test/npm_package/npm_package.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ describe('Zone.js npm_package', () => {
116116
expect(shx.cat('zone.js')).toMatch(/^\s*'use strict';/);
117117
});
118118
});
119+
120+
it('zone-patch-rxjs.js should have rxjs external', () => {
121+
checkInSubFolder('./fesm2015', () => {
122+
expect(shx.cat('zone-patch-rxjs.js')).toContain(` from 'rxjs'`);
123+
expect(shx.cat('zone-patch-rxjs.js')).toContain(`Zone.__load_patch('rxjs',`);
124+
});
125+
});
119126
});
120127

121128
describe('bundles file list', () => {

0 commit comments

Comments
 (0)