Skip to content

Commit

Permalink
fix(zone.js): correctly bundle zone-patch-rxjs (#55826)
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
alan-agius4 authored and atscott committed May 16, 2024
1 parent a768c90 commit 3055b92
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/zone.js/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,26 @@ 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'],
}),
commonjs(),
stripBannerPlugin,
],
external: (id) => {
if (/zone\.js[\\/]lib/.test(id)) {
return false;
}

return /rxjs|^electron/.test(id);
},
output: {
globals: {
electron: 'electron',
Expand Down
7 changes: 7 additions & 0 deletions packages/zone.js/test/npm_package/npm_package.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 3055b92

Please sign in to comment.