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

View File

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