mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +08:00
refactor(@angular-devkit/build-angular): replace raw-loader
with Webpack 5 asset modules
With Webpack 5, the `raw-loader` is no longer needed and its functionality is provided via configuration options within the Webpack configuration via asset modules. Asset modules (https://webpack.js.org/guides/asset-modules/) provide a built-in way to provide `raw-loader`, `url-loader`, and `file-loader` functionality without additional dependencies.
This commit is contained in:
parent
7ee3a80eaf
commit
6eca86b817
@ -201,7 +201,6 @@
|
|||||||
"protractor": "~7.0.0",
|
"protractor": "~7.0.0",
|
||||||
"puppeteer": "10.1.0",
|
"puppeteer": "10.1.0",
|
||||||
"quicktype-core": "6.0.69",
|
"quicktype-core": "6.0.69",
|
||||||
"raw-loader": "4.0.2",
|
|
||||||
"regenerator-runtime": "0.13.7",
|
"regenerator-runtime": "0.13.7",
|
||||||
"resolve-url-loader": "4.0.0",
|
"resolve-url-loader": "4.0.0",
|
||||||
"rxjs": "6.6.7",
|
"rxjs": "6.6.7",
|
||||||
|
@ -171,7 +171,6 @@ ts_library(
|
|||||||
"@npm//postcss-import",
|
"@npm//postcss-import",
|
||||||
"@npm//postcss-loader",
|
"@npm//postcss-loader",
|
||||||
"@npm//postcss-preset-env",
|
"@npm//postcss-preset-env",
|
||||||
"@npm//raw-loader",
|
|
||||||
"@npm//regenerator-runtime",
|
"@npm//regenerator-runtime",
|
||||||
"@npm//resolve-url-loader",
|
"@npm//resolve-url-loader",
|
||||||
"@npm//rxjs",
|
"@npm//rxjs",
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
"postcss-import": "14.0.2",
|
"postcss-import": "14.0.2",
|
||||||
"postcss-loader": "6.1.1",
|
"postcss-loader": "6.1.1",
|
||||||
"postcss-preset-env": "6.7.0",
|
"postcss-preset-env": "6.7.0",
|
||||||
"raw-loader": "4.0.2",
|
|
||||||
"regenerator-runtime": "0.13.7",
|
"regenerator-runtime": "0.13.7",
|
||||||
"resolve-url-loader": "4.0.0",
|
"resolve-url-loader": "4.0.0",
|
||||||
"rxjs": "6.6.7",
|
"rxjs": "6.6.7",
|
||||||
|
@ -242,7 +242,6 @@ export function getStylesConfig(wco: WebpackConfigOptions): webpack.Configuratio
|
|||||||
const postCssLoaderPath = require.resolve('postcss-loader');
|
const postCssLoaderPath = require.resolve('postcss-loader');
|
||||||
|
|
||||||
const componentStyleLoaders: webpack.RuleSetUseItem[] = [
|
const componentStyleLoaders: webpack.RuleSetUseItem[] = [
|
||||||
{ loader: require.resolve('raw-loader') },
|
|
||||||
{
|
{
|
||||||
loader: postCssLoaderPath,
|
loader: postCssLoaderPath,
|
||||||
options: {
|
options: {
|
||||||
@ -435,6 +434,7 @@ export function getStylesConfig(wco: WebpackConfigOptions): webpack.Configuratio
|
|||||||
{
|
{
|
||||||
exclude: globalStylePaths,
|
exclude: globalStylePaths,
|
||||||
use: componentStyleLoaders,
|
use: componentStyleLoaders,
|
||||||
|
type: 'asset/source',
|
||||||
},
|
},
|
||||||
// Global styles are only defined global styles
|
// Global styles are only defined global styles
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,6 @@ ts_library(
|
|||||||
"@npm//@angular/platform-browser-dynamic",
|
"@npm//@angular/platform-browser-dynamic",
|
||||||
"@npm//@types/node-fetch",
|
"@npm//@types/node-fetch",
|
||||||
"@npm//node-fetch",
|
"@npm//node-fetch",
|
||||||
"@npm//raw-loader",
|
|
||||||
"@npm//tslib",
|
"@npm//tslib",
|
||||||
"@npm//zone.js",
|
"@npm//zone.js",
|
||||||
],
|
],
|
||||||
|
@ -24,8 +24,8 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{ test: /\.css$/, loader: 'raw-loader' },
|
{ test: /\.css$/, type: 'asset/source' },
|
||||||
{ test: /\.html$/, loader: 'raw-loader' },
|
{ test: /\.html$/, type: 'asset/source' },
|
||||||
{ test: /\.ts$/, loader: '@ngtools/webpack' },
|
{ test: /\.ts$/, loader: '@ngtools/webpack' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
"zone.js": "^0.11.4"
|
"zone.js": "^0.11.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"raw-loader": "^4.0.2",
|
|
||||||
"sass": "^1.32.8",
|
"sass": "^1.32.8",
|
||||||
"sass-loader": "^11.0.1",
|
"sass-loader": "^11.0.1",
|
||||||
"typescript": "~4.3.2",
|
"typescript": "~4.3.2",
|
||||||
|
@ -3,25 +3,23 @@ const path = require('path');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.js']
|
extensions: ['.ts', '.js'],
|
||||||
},
|
},
|
||||||
entry: './app/main.ts',
|
entry: './app/main.ts',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve('./dist'),
|
path: path.resolve('./dist'),
|
||||||
publicPath: 'dist/',
|
publicPath: 'dist/',
|
||||||
filename: 'app.main.js'
|
filename: 'app.main.js',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [new ngToolsWebpack.AngularWebpackPlugin()],
|
||||||
new ngToolsWebpack.ivy.AngularWebpackPlugin(),
|
|
||||||
],
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{ test: /\.scss$/, use: ['raw-loader', 'sass-loader'] },
|
{ test: /\.scss$/, use: ['sass-loader'], type: 'asset/source' },
|
||||||
{ test: /\.html$/, loader: 'raw-loader' },
|
{ test: /\.html$/, type: 'asset/source' },
|
||||||
{ test: /\.ts$/, loader: ngToolsWebpack.ivy.AngularWebpackLoaderPath }
|
{ test: /\.ts$/, loader: ngToolsWebpack.AngularWebpackLoaderPath },
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
historyApiFallback: true
|
historyApiFallback: true,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
10
yarn.lock
10
yarn.lock
@ -94,7 +94,6 @@
|
|||||||
|
|
||||||
"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#876f2094018d2f0f32853784ffccab74ed1f344e":
|
"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#876f2094018d2f0f32853784ffccab74ed1f344e":
|
||||||
version "0.0.0"
|
version "0.0.0"
|
||||||
uid "876f2094018d2f0f32853784ffccab74ed1f344e"
|
|
||||||
resolved "https://github.com/angular/dev-infra-private-builds.git#876f2094018d2f0f32853784ffccab74ed1f344e"
|
resolved "https://github.com/angular/dev-infra-private-builds.git#876f2094018d2f0f32853784ffccab74ed1f344e"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@angular/benchpress" "0.2.1"
|
"@angular/benchpress" "0.2.1"
|
||||||
@ -9425,14 +9424,6 @@ raw-body@2.4.0:
|
|||||||
iconv-lite "0.4.24"
|
iconv-lite "0.4.24"
|
||||||
unpipe "1.0.0"
|
unpipe "1.0.0"
|
||||||
|
|
||||||
raw-loader@4.0.2:
|
|
||||||
version "4.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-4.0.2.tgz#1aac6b7d1ad1501e66efdac1522c73e59a584eb6"
|
|
||||||
integrity sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA==
|
|
||||||
dependencies:
|
|
||||||
loader-utils "^2.0.0"
|
|
||||||
schema-utils "^3.0.0"
|
|
||||||
|
|
||||||
read-cache@^1.0.0:
|
read-cache@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774"
|
resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774"
|
||||||
@ -9968,7 +9959,6 @@ sass@1.35.1, sass@^1.32.8:
|
|||||||
|
|
||||||
"sauce-connect-proxy@https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz":
|
"sauce-connect-proxy@https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz":
|
||||||
version "0.0.0"
|
version "0.0.0"
|
||||||
uid "992e2cb0d91e54b27a4f5bbd2049f3b774718115"
|
|
||||||
resolved "https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz#992e2cb0d91e54b27a4f5bbd2049f3b774718115"
|
resolved "https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz#992e2cb0d91e54b27a4f5bbd2049f3b774718115"
|
||||||
|
|
||||||
saucelabs@^1.5.0:
|
saucelabs@^1.5.0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user