Build: Replace the file-loader loader with asset module in webpack config (#53088)

This commit is contained in:
Esteban Beltran
2022-08-04 10:29:42 +02:00
committed by GitHub
parent 6b8316d510
commit 112f69177b
5 changed files with 193 additions and 211 deletions
+7 -9
View File
@@ -2,7 +2,6 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const CopyUniconsPlugin = require('./plugins/CopyUniconsPlugin');
const CorsWorkerPlugin = require('./plugins/CorsWorkerPlugin');
module.exports = {
@@ -45,7 +44,6 @@ module.exports = {
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new CopyUniconsPlugin(),
new CopyWebpackPlugin({
patterns: [
{
@@ -98,15 +96,15 @@ module.exports = {
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
// for pre-caching SVGs as part of the JS bundles
{
test: /\.svg$/,
use: 'raw-loader',
},
{
test: /\.(svg|ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/,
loader: 'file-loader',
options: { name: 'static/img/[name].[contenthash:8].[ext]' },
type: 'asset/resource',
generator: { filename: 'static/img/[name].[hash:8][ext]' },
},
// for pre-caching SVGs as part of the JS bundles
{
test: /(unicons|mono|custom)[\\/].*\.svg$/,
type: 'asset/source',
},
],
},