Web:Login: add new webpack rules for assets

This commit is contained in:
Timofey Boyko 2022-12-27 16:59:04 +03:00
parent 08fb97d7fd
commit 205fc24365
2 changed files with 25 additions and 0 deletions

View File

@ -39,8 +39,19 @@ module.exports = {
test: fontsExtension,
type: "asset",
},
{
test: /\.(png|jpe?g|gif|ico)$/i,
type: "asset/resource",
},
{
test: /\.svg$/i,
type: "asset/resource",
resourceQuery: /url/, // *.svg?url
},
{
test: /\.react.svg$/,
issuer: /\.[jt]sx?$/,
resourceQuery: { not: [/url/] }, // exclude react component if *.svg?url
use: [
{
loader: "@svgr/webpack",

View File

@ -30,6 +30,20 @@ const clientConfig = {
filename: "static/js/[name].[contenthash].bundle.js",
publicPath: "/login/",
chunkFilename: "static/js/[id].[contenthash].js",
assetModuleFilename: (pathData) => {
//console.log({ pathData });
let result = pathData.filename
.substr(pathData.filename.indexOf("public/"))
.split("/")
.slice(1);
result.pop();
let folder = result.join("/");
return `${folder}/[name].[contenthash][ext]`; //`${folder}/[name][ext]?hash=[contenthash]`;
},
},
performance: {