Skip to content

Commit b297179

Browse files
actra-gschusterhansl
authored andcommitted
fix(@angular-devkit/build-optimizer): support disabled webpack cache (#138)
Fix #136
1 parent 581156e commit b297179

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@types/semver": "^5.3.30",
5353
"@types/source-map": "^0.5.0",
5454
"@types/webpack": "^3.0.2",
55+
"@types/webpack-sources": "^0.1.3",
5556
"common-tags": "^1.3.1",
5657
"conventional-changelog": "^1.1.0",
5758
"glob": "^7.0.3",
@@ -71,7 +72,8 @@
7172
"ts-node": "^2.0.0",
7273
"tslint": "^5.5.0",
7374
"typescript": "~2.3.0",
74-
"v8-profiler": "^5.7.0"
75+
"v8-profiler": "^5.7.0",
76+
"webpack-sources": "^1.0.1"
7577
},
7678
"devDependencies": {
7779
"protobufjs": "5.0.0"

packages/angular_devkit/build_optimizer/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dependencies": {
1212
"loader-utils": "^1.1.0",
1313
"source-map": "^0.5.6",
14-
"typescript": "^2.3.3"
14+
"typescript": "^2.3.3",
15+
"webpack-sources": "^1.0.1"
1516
}
1617
}

packages/angular_devkit/build_optimizer/src/purify/webpack-plugin.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import * as webpack from 'webpack';
9+
import { ConcatSource, RawSource } from 'webpack-sources';
910
import { purify } from './purify';
1011

1112

@@ -23,9 +24,8 @@ export class PurifyPlugin {
2324
chunk.files
2425
.filter((fileName: string) => fileName.endsWith('.js'))
2526
.forEach((fileName: string) => {
26-
const purifiedSource = purify(compilation.assets[fileName].source());
27-
compilation.assets[fileName]._cachedSource = purifiedSource;
28-
compilation.assets[fileName]._source.source = () => purifiedSource;
27+
const purified: string = purify(compilation.assets[fileName].source());
28+
compilation.assets[fileName] = new ConcatSource(new RawSource(purified));
2929
});
3030
});
3131
callback();

0 commit comments

Comments
 (0)