Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
fix(angular): don't instrument code when building for production
Browse files Browse the repository at this point in the history
  • Loading branch information
urish committed Jul 29, 2018
1 parent 062623c commit 3d46307
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/typewiz-angular/src/patch-angular.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('patch-angular', () => {
const { typewizTransformer } = require('typewiz-core');
const core_1 = require("@angular-devkit/core");
class AngularCompilerPlugin {
_makeTransformers() {this._transformers.push(typewizTransformer({}));
_makeTransformers() {if (this._JitMode) { this._transformers.push(typewizTransformer({})); }
// foo
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/typewiz-angular/src/patch-angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export function patchCompiler(compilerSource: string) {

const replacements = [
Replacement.insert(firstConst.getStart(), `const { typewizTransformer } = require('typewiz-core');\n`),
Replacement.insert(makeTransformersMethod.getStart() + 1, `this._transformers.push(typewizTransformer({}));`),
Replacement.insert(
makeTransformersMethod.getStart() + 1,
`if (this._JitMode) { this._transformers.push(typewizTransformer({})); }`,
),
];
return applyReplacements(compilerSource, replacements);
}
Expand Down

0 comments on commit 3d46307

Please sign in to comment.