THREE.js doesn't like the timestamp name,

cause every language bundle builds its own three.js
change order of script insertion (vendor before client)
This commit is contained in:
HF 2023-12-11 20:54:52 +01:00
parent d2fa61f3c6
commit 6b0404b66d
2 changed files with 14 additions and 15 deletions

View File

@ -34,7 +34,7 @@ function checkAssets() {
const parts = filename.split('.');
// File needs to have a timestamp in its name
if (parts.length < 3 || Number.isNaN(Number(parts[parts.length - 2]))) {
if (parts.length < 3) {
continue;
}
// if multiple candidates exist, take most recent created file
@ -81,12 +81,6 @@ assets = checkAssets();
export function getJsAssets(name, lang) {
const jsAssets = [];
const mainAsset = (lang && assets.js[name][lang])
|| assets.js[name].default
|| assets.js[name];
if (mainAsset) {
jsAssets.push(mainAsset);
}
switch (name) {
case 'client':
@ -98,6 +92,14 @@ export function getJsAssets(name, lang) {
default:
// nothing
}
const mainAsset = (lang && assets.js[name][lang])
|| assets.js[name].default
|| assets.js[name];
if (mainAsset) {
jsAssets.push(mainAsset);
}
return jsAssets;
}

View File

@ -13,11 +13,6 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
*/
process.chdir(__dirname);
/*
* timestamp for filenames
*/
const buildTs = Date.now();
function buildWebpackClientConfig(
development,
analyze,
@ -68,9 +63,9 @@ function buildWebpackClientConfig(
output: {
path: path.resolve('dist', 'public', 'assets'),
// publicPath: '/assets/', // Is this neccessary?
filename: `[name].${buildTs}.js`,
chunkFilename: `[name].${locale}.${buildTs}.js`,
publicPath: '/assets/',
filename: `[name].[chunkhash:8].js`,
chunkFilename: `[name].${locale}.[chunkhash:8].js`,
},
resolve: {
@ -170,6 +165,8 @@ function buildWebpackClientConfig(
},
},
recordsPath: path.join(__dirname, 'records.json'),
stats: {
colors: true,
reasons: false,