Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(@ngtools/webpack): performance improvement.
Bringing it back to 1.1.7 levels. Turns out I was reading files for every
require() calls resolving steps. Which is a bad thing.
  • Loading branch information
hansl committed Dec 2, 2016
commit 264bbce0ce66e289e2181f2a77f458a19b13c5ff
11 changes: 5 additions & 6 deletions packages/webpack/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ export class AotPlugin implements Tapable {
this._compiler = compiler;

compiler.plugin('context-module-factory', (cmf: any) => {
cmf.resolvers.normal.apply(new PathsPlugin({
tsConfigPath: this._tsConfigPath,
compilerOptions: this._compilerOptions,
compilerHost: this._compilerHost
}));

cmf.plugin('before-resolve', (request: any, callback: (err?: any, request?: any) => void) => {
if (!request) {
return callback();
Expand Down Expand Up @@ -209,6 +203,11 @@ export class AotPlugin implements Tapable {
cb();
}
});
compiler.resolvers.normal.apply(new PathsPlugin({
tsConfigPath: this._tsConfigPath,
compilerOptions: this._compilerOptions,
compilerHost: this._compilerHost
}));
}

private _make(compilation: any, cb: (err?: any, request?: any) => void) {
Expand Down
14 changes: 6 additions & 8 deletions packages/webpack/src/refactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,14 @@ export class TypeScriptFileRefactor {
}

transpile(compilerOptions: ts.CompilerOptions): TranspileOutput {
compilerOptions = Object.assign({}, compilerOptions, {
sourceMap: true,
inlineSources: false,
inlineSourceMap: false,
sourceRoot: ''
});

const source = this.sourceText;
const result = ts.transpileModule(source, {
compilerOptions,
compilerOptions: Object.assign({}, compilerOptions, {
sourceMap: true,
inlineSources: false,
inlineSourceMap: false,
sourceRoot: ''
}),
fileName: this._fileName
});

Expand Down