Skip to content

Commit

Permalink
Remove file-loader dependency (#15196)
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
4 people committed Mar 30, 2021
1 parent cce006b commit d099f08
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 56 deletions.
37 changes: 3 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"easymde": "2.14.0",
"escape-goat": "3.0.0",
"fast-glob": "3.2.5",
"file-loader": "6.2.0",
"font-awesome": "4.7.0",
"jquery": "3.6.0",
"jquery.are-you-sure": "1.9.0",
Expand All @@ -44,7 +43,7 @@
"vue-calendar-heatmap": "0.8.4",
"vue-loader": "15.9.6",
"vue-template-compiler": "2.6.12",
"webpack": "5.27.1",
"webpack": "5.28.0",
"webpack-cli": "4.5.0",
"workbox-routing": "6.1.2",
"workbox-strategies": "6.1.2",
Expand Down
30 changes: 10 additions & 20 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
},
],
},
Expand Down

0 comments on commit d099f08

Please sign in to comment.