Revert "refactor: Update webpack configuration to improve git commit hash retrieval and enhance lazy loading of components for better performance"
This reverts commit 52c9888a6a.
This commit is contained in:
@@ -5,31 +5,17 @@ import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
import ESLintPlugin from 'eslint-webpack-plugin';
|
||||
import { cpSync } from 'fs';
|
||||
import { execFileSync } from 'child_process';
|
||||
import { execSync } from 'child_process';
|
||||
import webpack from 'webpack';
|
||||
import fs from 'fs';
|
||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||
|
||||
// Git hash for meta tag / currentHash.json — avoid execSync (spawns /bin/sh; fails with EPERM in some sandboxes/CI)
|
||||
// Get git commit hash
|
||||
const getGitCommitHash = () => {
|
||||
const fromEnv =
|
||||
process.env.GIT_COMMIT ||
|
||||
process.env.VERCEL_GIT_COMMIT_SHA ||
|
||||
process.env.CI_COMMIT_SHA ||
|
||||
process.env.GITHUB_SHA ||
|
||||
'';
|
||||
if (fromEnv) return String(fromEnv).trim();
|
||||
|
||||
try {
|
||||
return execFileSync('git', ['rev-parse', 'HEAD'], {
|
||||
encoding: 'utf8',
|
||||
maxBuffer: 1024 * 1024,
|
||||
}).trim();
|
||||
return execSync('git rev-parse HEAD').toString().trim();
|
||||
} catch (e) {
|
||||
console.warn(
|
||||
'Git commit hash unavailable (set GIT_COMMIT or run build in a git repo):',
|
||||
e && e.message ? e.message : e
|
||||
);
|
||||
console.error('Failed to get git commit hash:', e);
|
||||
return 'unknown';
|
||||
}
|
||||
};
|
||||
@@ -315,36 +301,9 @@ export default {
|
||||
priority: 20,
|
||||
reuseExistingChunk: true,
|
||||
},
|
||||
// Keep Stripe checkout code out of the initial vendor bundle
|
||||
stripe: {
|
||||
test: /[\\/]node_modules[\\/]@stripe[\\/]/,
|
||||
name: 'stripe',
|
||||
priority: 19,
|
||||
chunks: 'async',
|
||||
reuseExistingChunk: true,
|
||||
enforce: true,
|
||||
},
|
||||
// Lazy HTML parsing/sanitizing should stay async with the product detail/chat flows
|
||||
htmlParser: {
|
||||
test: /[\\/]node_modules[\\/](html-react-parser|sanitize-html|htmlparser2|domhandler|dom-serializer|entities|react-property|parse-srcset|postcss)[\\/]/,
|
||||
name: 'html-parser-vendor',
|
||||
priority: 18,
|
||||
chunks: 'async',
|
||||
reuseExistingChunk: true,
|
||||
enforce: true,
|
||||
},
|
||||
// Girocode/QR code generation is only needed in checkout/profile flows
|
||||
payments: {
|
||||
test: /[\\/]node_modules[\\/](qrcode|sepa-payment-qr-code|iban)[\\/]/,
|
||||
name: 'payments',
|
||||
priority: 17,
|
||||
chunks: 'async',
|
||||
reuseExistingChunk: true,
|
||||
enforce: true,
|
||||
},
|
||||
// socket.io-client and its dependencies — always async, never initial
|
||||
socketio: {
|
||||
test: /[\\/]node_modules[\\/](socket\.io-client|engine\.io-client|engine\.io-parser|@socket\.io|socket\.io-parser|socket\.io-msgpack-parser)[\\/]/,
|
||||
test: /[\\/]node_modules[\\/](socket\.io-client|engine\.io-client|@socket\.io|socket\.io-parser|socket\.io-msgpack-parser)[\\/]/,
|
||||
name: 'socketio',
|
||||
priority: 15,
|
||||
chunks: 'async',
|
||||
|
||||
Reference in New Issue
Block a user