Skip to content

Commit dd0fd18

Browse files
committed
refactor(@ngtools/webpack): remove redundant webpack-sources dependency
The `webpack` package now exports the `Source` based classes directly.
1 parent 46ffe26 commit dd0fd18

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

packages/ngtools/webpack/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ ts_library(
3737
deps = [
3838
"@npm//@angular/compiler-cli",
3939
"@npm//@types/node",
40-
"@npm//@types/webpack-sources",
4140
"@npm//enhanced-resolve",
4241
"@npm//typescript",
4342
"@npm//webpack",
44-
"@npm//webpack-sources",
4543
],
4644
)
4745

packages/ngtools/webpack/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
},
2222
"homepage": "https://github.com/angular/angular-cli/tree/master/packages/@ngtools/webpack",
2323
"dependencies": {
24-
"enhanced-resolve": "5.7.0",
25-
"webpack-sources": "2.2.0"
24+
"enhanced-resolve": "5.7.0"
2625
},
2726
"peerDependencies": {
2827
"@angular/compiler-cli": "^12.0.0-next",

packages/ngtools/webpack/src/resource_loader.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import * as vm from 'vm';
9-
import { Compilation, EntryPlugin, NormalModule, library, node } from 'webpack';
10-
import { RawSource } from 'webpack-sources';
9+
import { Compilation, EntryPlugin, NormalModule, library, node, sources } from 'webpack';
1110
import { normalizePath } from './ivy/paths';
1211

1312
interface CompilationOutput {
@@ -136,9 +135,7 @@ export class WebpackResourceLoader {
136135
const output = this._evaluate(outputFilePath, asset.source().toString());
137136

138137
if (typeof output === 'string') {
139-
// `webpack-sources` package has incomplete typings
140-
// tslint:disable-next-line: no-any
141-
compilation.assets[outputFilePath] = new RawSource(output) as any;
138+
compilation.assets[outputFilePath] = new sources.RawSource(output);
142139
}
143140
} catch (error) {
144141
// Use compilation errors, as otherwise webpack will choke

0 commit comments

Comments
 (0)