Skip to content

Commit bee20d2

Browse files
clydinfilipesilva
authored andcommitted
fix(@angular-devkit/build-optimizer): mark rxjs add imports as having side effects
This change prevents the build optimizer from removing the operator add imports from the rxjs package (for example, `import 'rxjs/add/operator/filter';`). The entire rxjs package is currently marked as side effect free from within the rxjs `package.json` but the files in the add directory intentionally contain side effects.
1 parent e70562f commit bee20d2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/angular_devkit/build_optimizer/src/build-optimizer/build-optimizer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ function isKnownCoreFile(filePath: string) {
5454
}
5555

5656
function isKnownSideEffectFree(filePath: string) {
57+
// rxjs add imports contain intentional side effects
58+
if (/[\\/]node_modules[\\/]rxjs[\\/]add[\\/]/.test(filePath)) {
59+
return false;
60+
}
61+
5762
return ngFactories.some((s) => filePath.endsWith(s)) ||
5863
knownSideEffectFreeAngularModules.some((re) => re.test(filePath));
5964
}

0 commit comments

Comments
 (0)