- Changed API proxy target from localhost:5000 to localhost:5500 in both webpack configurations. - Updated server port from 5000 to 5500 in src/index.js for consistency. - Upgraded OpenAI model from "gpt-4o-mini" to "gpt-5-mini" in document processing routes, enhancing processing capabilities.
98 lines
2.3 KiB
JavaScript
98 lines
2.3 KiB
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const webpack = require('webpack');
|
|
require('dotenv').config();
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
entry: './client/src/index.js',
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'js/[name].[contenthash].js',
|
|
chunkFilename: 'js/[name].[contenthash].chunk.js',
|
|
publicPath: '/',
|
|
clean: true, // Clean dist folder before build
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env', '@babel/preset-react'],
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', 'css-loader'],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: './client/public/index.html',
|
|
templateParameters: {
|
|
REACT_APP_GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID || 'your_google_client_id_here',
|
|
},
|
|
minify: {
|
|
removeComments: true,
|
|
collapseWhitespace: true,
|
|
removeRedundantAttributes: true,
|
|
useShortDoctype: true,
|
|
removeEmptyAttributes: true,
|
|
removeStyleLinkTypeAttributes: true,
|
|
keepClosingSlash: true,
|
|
minifyJS: true,
|
|
minifyCSS: true,
|
|
minifyURLs: true,
|
|
},
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'process.env': {
|
|
NODE_ENV: JSON.stringify('production'),
|
|
REACT_APP_GOOGLE_CLIENT_ID: JSON.stringify(process.env.GOOGLE_CLIENT_ID),
|
|
},
|
|
}),
|
|
],
|
|
optimization: {
|
|
splitChunks: {
|
|
chunks: 'all',
|
|
cacheGroups: {
|
|
vendor: {
|
|
test: /[\\/]node_modules[\\/]/,
|
|
name: 'vendors',
|
|
chunks: 'all',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.jsx'],
|
|
},
|
|
devServer: {
|
|
port: 5001,
|
|
host: '0.0.0.0',
|
|
allowedHosts: 'all',
|
|
historyApiFallback: true,
|
|
hot: false,
|
|
liveReload: false,
|
|
client: false,
|
|
static: {
|
|
directory: path.join(__dirname, 'client/public'),
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:5500',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
performance: {
|
|
maxAssetSize: 512000,
|
|
maxEntrypointSize: 512000,
|
|
},
|
|
};
|