51 lines
1.2 KiB
JavaScript
51 lines
1.2 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'),
|
|
filename: 'bundle.js',
|
|
publicPath: '/',
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env', '@babel/preset-react'],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.jsx'],
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: './public/index.html',
|
|
})
|
|
],
|
|
devServer: {
|
|
static: {
|
|
directory: path.join(__dirname, 'dist'),
|
|
},
|
|
compress: true,
|
|
port: 3000,
|
|
host: '127.0.0.1', // Listen only on localhost, external access via Nginx proxy
|
|
hot: true,
|
|
historyApiFallback: true,
|
|
allowedHosts: 'all', // Allow all hosts to prevent "invalid host header" error
|
|
client: {
|
|
webSocketURL: 'auto://0.0.0.0:0/ws'
|
|
},
|
|
proxy: {
|
|
'/api': 'http://127.0.0.1:3001', // Proxy API calls to Express server
|
|
},
|
|
},
|
|
}; |