diff options
author | silverwind | 2021-03-30 13:17:24 +0200 |
---|---|---|
committer | GitHub | 2021-03-30 19:17:24 +0800 |
commit | d099f0858f7554bd21c871bedb5e60e20e0eb9c9 (patch) | |
tree | 1304d7205deca55d93bfb8db34ec10ffab84b33c /webpack.config.js | |
parent | cce006b857e273c58fc66b1aba20a9f719c7adef (diff) |
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>
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/webpack.config.js b/webpack.config.js index 931cc62f9..11c92e874 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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 + } }, ], }, |