Skip to content

Commit 77b3981

Browse files
filipesilvavikerman
authored andcommitted
fix(@angular-devkit/build-optimizer): don't remove ɵɵsetNgModuleScope calls
These will be automatically removed after angular/angular#33671 lands because they are in a side-effect free IIFE.
1 parent ed4bf6e commit 77b3981

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

packages/angular_devkit/build_optimizer/src/transforms/scrub-file.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export function testScrubFile(content: string) {
1818
'propDecorators',
1919
'ctorParameters',
2020
'ɵsetClassMetadata',
21-
'ɵɵsetNgModuleScope',
2221
];
2322

2423
return markers.some((marker) => content.indexOf(marker) !== -1);
@@ -313,8 +312,7 @@ function isIvyPrivateCallExpression(exprStmt: ts.ExpressionStatement) {
313312
return false;
314313
}
315314

316-
if (propAccExpr.name.text != 'ɵsetClassMetadata'
317-
&& propAccExpr.name.text != 'ɵɵsetNgModuleScope') {
315+
if (propAccExpr.name.text != 'ɵsetClassMetadata') {
318316
return false;
319317
}
320318

packages/angular_devkit/build_optimizer/src/transforms/scrub-file_spec.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -735,20 +735,5 @@ describe('scrub-file', () => {
735735
expect(testScrubFile(input)).toBeTruthy();
736736
expect(tags.oneLine`${transform(input)}`).toEqual(tags.oneLine`${output}`);
737737
});
738-
739-
it('removes ɵɵsetNgModuleScope call', () => {
740-
const output = tags.stripIndent`
741-
import { CommonModule } from '@angular/common';
742-
import * as i0 from "@angular/core";
743-
${clazz}
744-
`;
745-
const input = tags.stripIndent`
746-
${output}
747-
/*@__PURE__*/ i0.ɵɵsetNgModuleScope(Clazz, { declarations: [], imports: [CommonModule] });
748-
`;
749-
750-
expect(testScrubFile(input)).toBeTruthy();
751-
expect(tags.oneLine`${transform(input)}`).toEqual(tags.oneLine`${output}`);
752-
});
753738
});
754739
});

0 commit comments

Comments
 (0)