This commit is contained in:
Andras Schmelczer 2026-05-17 10:16:30 +01:00
parent 47d89f6fad
commit 017902b8e6
82 changed files with 331466 additions and 54841 deletions

View file

@ -6,11 +6,36 @@ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const sharp = require('sharp');
const webpack = require('webpack');
const packageJson = require('./package.json');
const HOUSE_IMAGE_WIDTH = 260;
function envString(...names) {
for (const name of names) {
const value = process.env[name];
if (typeof value === 'string' && value.trim().length > 0) {
return value.trim();
}
}
return undefined;
}
function envBoolean(name, fallback = false) {
const value = process.env[name];
if (typeof value !== 'string' || value.trim().length === 0) {
return fallback;
}
return ['1', 'true', 'yes', 'on'].includes(value.trim().toLowerCase());
}
module.exports = (env, argv) => {
const isProduction = argv.mode === 'production';
const bugsinkEnvironment =
envString('FRONTEND_BUGSINK_ENVIRONMENT', 'BUGSINK_ENVIRONMENT', 'SENTRY_ENVIRONMENT') ||
(isProduction ? 'production' : 'development');
const bugsinkRelease =
envString('FRONTEND_BUGSINK_RELEASE', 'BUGSINK_RELEASE', 'SENTRY_RELEASE') ||
`${packageJson.name}@${packageJson.version}`;
return {
entry: './src/index.tsx',
@ -22,6 +47,7 @@ module.exports = (env, argv) => {
publicPath: '/',
},
devtool: isProduction ? 'hidden-source-map' : 'eval-cheap-module-source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
@ -62,6 +88,14 @@ module.exports = (env, argv) => {
plugins: [
new webpack.DefinePlugin({
__DEV__: JSON.stringify(!isProduction),
__BUGSINK_DSN__: JSON.stringify(
envString('FRONTEND_BUGSINK_DSN', 'PUBLIC_BUGSINK_DSN', 'BUGSINK_DSN') || ''
),
__BUGSINK_ENVIRONMENT__: JSON.stringify(bugsinkEnvironment),
__BUGSINK_RELEASE__: JSON.stringify(bugsinkRelease),
__BUGSINK_SEND_DEFAULT_PII__: JSON.stringify(
envBoolean('BUGSINK_SEND_DEFAULT_PII', false)
),
}),
new HtmlWebpackPlugin({
template: './src/index.html',