UX: Reduce JS bundle size by loading translation files on demand #4778

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-03-24 12:43:08 +01:00
parent a125219751
commit 0ddc179737
52 changed files with 126 additions and 44 deletions

View File

@@ -46,7 +46,6 @@ const PATHS = {
share: path.join(__dirname, "src/share.js"),
splash: path.join(__dirname, "src/splash.js"),
build: path.join(__dirname, "../assets/static/build"),
public: "./",
};
if (isCustom) {
@@ -72,8 +71,10 @@ const config = {
},
output: {
path: PATHS.build,
publicPath: PATHS.public,
publicPath: "auto",
filename: "[name].[contenthash].js",
chunkFilename: "chunk/[name].[contenthash].js",
asyncChunks: true,
clean: true,
},
resolve: {
@@ -147,6 +148,11 @@ const config = {
},
],
},
{
test: /\.json$/,
include: PATHS.src,
type: "json",
},
{
test: /\.css$/,
include: isCustom ? [PATHS.custom, PATHS.css] : [PATHS.css],
@@ -154,9 +160,6 @@ const config = {
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: PATHS.public,
},
},
{
loader: "css-loader",
@@ -183,9 +186,6 @@ const config = {
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: PATHS.public,
},
},
{
loader: "css-loader",
@@ -211,9 +211,6 @@ const config = {
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: PATHS.public,
},
},
{
loader: "css-loader",