1
0
Fork 0
forked from forgejo/forgejo

Remove file-loader dependency (#15196)

- Upgrade webpack to 5.28 to enable publicPath option
- Use asset modules in place of deprecated file-loader

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
silverwind 2021-03-30 13:17:24 +02:00 committed by GitHub
parent cce006b857
commit d099f0858f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 56 deletions

View file

@ -211,29 +211,19 @@ module.exports = {
},
{
test: /\.(ttf|woff2?)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/',
publicPath: (url) => `../fonts/${url}`, // required to remove css/ path segment
},
},
],
type: 'asset/resource',
generator: {
filename: 'fonts/[name][ext]',
publicPath: '/', // required to remove css/ path segment
}
},
{
test: /\.png$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'img/webpack/',
publicPath: (url) => `../img/webpack/${url}`, // required to remove css/ path segment
},
},
],
type: 'asset/resource',
generator: {
filename: 'img/webpack/[name][ext]',
publicPath: '/', // required to remove css/ path segment
}
},
],
},