replace file-loader and url-loader with asset modules in manager webpack5 config

This commit is contained in:
Kyle Herock 2021-09-15 12:17:50 -04:00
parent 1dff968be4
commit cf09866578
3 changed files with 11 additions and 11 deletions

View File

@ -59,7 +59,6 @@
"css-loader": "^5.0.1",
"dotenv-webpack": "^7.0.0",
"express": "^4.17.1",
"file-loader": "^6.2.0",
"file-system-cache": "^1.0.5",
"find-up": "^5.0.0",
"fs-extra": "^9.0.1",
@ -72,7 +71,6 @@
"telejson": "^5.3.2",
"terser-webpack-plugin": "^5.0.3",
"ts-dedent": "^2.0.0",
"url-loader": "^4.1.1",
"util-deprecate": "^1.0.2",
"webpack": "^5.9.0",
"webpack-dev-middleware": "^4.1.0",

View File

@ -138,19 +138,23 @@ export async function managerWebpack(
},
{
test: /\.(svg|ico|jpg|jpeg|png|apng|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/,
loader: require.resolve('file-loader'),
options: {
name: isProd
type: 'asset/resource',
generator: {
filename: isProd
? 'static/media/[name].[contenthash:8][ext]'
: 'static/media/[path][name][ext]',
},
},
{
test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/,
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: isProd
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 10000,
},
},
generator: {
filename: isProd
? 'static/media/[name].[contenthash:8][ext]'
: 'static/media/[path][name][ext]',
},

View File

@ -8414,7 +8414,6 @@ __metadata:
css-loader: ^5.0.1
dotenv-webpack: ^7.0.0
express: ^4.17.1
file-loader: ^6.2.0
file-system-cache: ^1.0.5
find-up: ^5.0.0
fs-extra: ^9.0.1
@ -8427,7 +8426,6 @@ __metadata:
telejson: ^5.3.2
terser-webpack-plugin: ^5.0.3
ts-dedent: ^2.0.0
url-loader: ^4.1.1
util-deprecate: ^1.0.2
webpack: ^5.9.0
webpack-dev-middleware: ^4.1.0