Skip to content

Commit 6732294

Browse files
committed
refactor(@angular-devkit/build-angular): remove file-loader dependency
`file-loader` resolves `import/require()` on a file into a url. This is non standard, undocumented, unsupported Webpack specific functionality. This was introduced in the Angular CLI before `postcss-cli-resources` existed and was never removed. Using `file-loader` and `postcss-cli-resources` are no longer needed with Webpack 5, because of the introduction of [Assets Modules](https://webpack.js.org/guides/asset-modules/). BREAKING CHANGE: The unsupported/undocumented, Webpack specific functionality to `import`/`require()` a non-module file has been removed. Before ```js import img from './images/asset.png'; ``` After ```html <img src="images/asset.png"> ```
1 parent 3ddad97 commit 6732294

File tree

5 files changed

+0
-20
lines changed

5 files changed

+0
-20
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
"enhanced-resolve": "5.7.0",
150150
"express": "4.17.1",
151151
"fast-json-stable-stringify": "2.1.0",
152-
"file-loader": "6.2.0",
153152
"find-cache-dir": "3.3.1",
154153
"font-awesome": "^4.7.0",
155154
"gh-got": "^9.0.0",

packages/angular_devkit/build_angular/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ ts_library(
150150
"@npm//critters",
151151
"@npm//css-loader",
152152
"@npm//cssnano",
153-
"@npm//file-loader",
154153
"@npm//find-cache-dir",
155154
"@npm//glob",
156155
"@npm//https-proxy-agent",

packages/angular_devkit/build_angular/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"critters": "0.0.6",
3333
"css-loader": "5.0.1",
3434
"cssnano": "4.1.10",
35-
"file-loader": "6.2.0",
3635
"find-cache-dir": "3.3.1",
3736
"glob": "7.1.6",
3837
"https-proxy-agent": "5.0.0",

packages/angular_devkit/build_angular/src/webpack/configs/common.ts

-9
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,6 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
514514
// Show an error for missing exports instead of a warning.
515515
strictExportPresence: true,
516516
rules: [
517-
{
518-
test: /\.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani|avif)$/,
519-
loader: require.resolve('file-loader'),
520-
options: {
521-
name: `[name]${hashFormat.file}.[ext]`,
522-
// Re-use emitted files from browser builder on the server.
523-
emitFile: platform !== 'server',
524-
},
525-
},
526517
{
527518
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
528519
// Removing this will cause deprecation warnings to appear.

yarn.lock

-8
Original file line numberDiff line numberDiff line change
@@ -5199,14 +5199,6 @@ figures@^3.0.0, figures@^3.2.0:
51995199
dependencies:
52005200
escape-string-regexp "^1.0.5"
52015201

5202-
5203-
version "6.2.0"
5204-
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
5205-
integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==
5206-
dependencies:
5207-
loader-utils "^2.0.0"
5208-
schema-utils "^3.0.0"
5209-
52105202
52115203
version "1.0.0"
52125204
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"

0 commit comments

Comments
 (0)