- BuildConfig.sh: ${DEBUG:false} -> ${DEBUG:-false} and normalize to
true/false. The old syntax produced empty -> invalid config.json
("DEBUG": }) when DEBUG was unset, breaking the whole frontend.
- webpack: output [name].[contenthash].js so index.html references a
unique bundle URL each build; eliminates stale CDN/browser bundle
after deploys (no manual cache purge needed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
61 lines
1.7 KiB
JavaScript
61 lines
1.7 KiB
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const webpack = require('webpack');
|
|
module.exports = {
|
|
entry: './src/index.js',
|
|
output: {
|
|
path: path.resolve(__dirname, './dist'),
|
|
// Content-hashed filename: index.html (injected by HtmlWebpackPlugin,
|
|
// and not edge-cached) points at a unique URL each build, so a new
|
|
// deploy is picked up immediately — no stale CDN/browser bundle.
|
|
filename: '[name].[contenthash].js',
|
|
chunkFilename: '[name].[contenthash].js',
|
|
publicPath: '/',
|
|
clean: true,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', 'css-loader', 'postcss-loader'],
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: "./public/index.html",
|
|
inject: true
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
process: 'process/browser.js'
|
|
})
|
|
|
|
],
|
|
devServer: {
|
|
static: path.join(__dirname, 'public'),
|
|
port: 3000,
|
|
open: true,
|
|
hot: true,
|
|
historyApiFallback: true,
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'process/browser': require.resolve('process/browser.js')
|
|
},
|
|
fallback: {
|
|
path: require.resolve('path-browserify'),
|
|
fs: false,
|
|
assert: require.resolve("assert/"),
|
|
process: require.resolve("process/browser.js"),
|
|
}
|
|
},
|
|
devtool: 'source-map',
|
|
};
|