Webpack: use new asset module instead of deprecated file-loader

This commit is contained in:
Alice Gaudon 2021-09-22 15:36:26 +02:00
parent 7672a5fbe4
commit 42e636a3d1
3 changed files with 13 additions and 27 deletions

View File

@ -41,7 +41,6 @@
"electron": "^15.0.0",
"electron-builder": "^22.11.5",
"eslint": "^7.10.0",
"file-loader": "^6.0.0",
"image-minimizer-webpack-plugin": "^2.2.0",
"imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^9.0.0",

View File

@ -46,14 +46,17 @@ const config = {
},
{
test: /\.(woff2?|eot|ttf|otf)$/i,
use: 'file-loader?name=../fonts/[name].[ext]',
type: 'asset/resource',
generator: {
filename: '../fonts/[name][ext]',
},
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
use: [
'file-loader?name=../images/[name].[ext]',
],
type: 'asset',
type: 'asset/resource',
generator: {
filename: '../images/[name][ext]',
},
},
{
test: /\.ts$/i,
@ -63,13 +66,14 @@ const config = {
configFile: 'tsconfig.frontend.json',
}
},
exclude: '/node_modules/'
exclude: '/node_modules/',
},
{
test: /\.html$/i,
use: [
'file-loader?name=../[name].[ext]',
]
type: 'asset/resource',
generator: {
filename: '../[name][ext]',
},
}
],
},

View File

@ -2956,14 +2956,6 @@ file-entry-cache@^6.0.1:
dependencies:
flat-cache "^3.0.4"
file-loader@^6.0.0:
version "6.2.0"
resolved "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==
dependencies:
loader-utils "^2.0.0"
schema-utils "^3.0.0"
file-type@5.2.0, file-type@^5.2.0:
version "5.2.0"
resolved "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz#2ddbea7c73ffe36368dfae49dc338c058c2b8ad6"
@ -4015,15 +4007,6 @@ loader-utils@^1.4.0:
emojis-list "^3.0.0"
json5 "^1.0.1"
loader-utils@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^2.1.2"
locate-path@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"