Fix port for real
This commit is contained in:
parent
0c6283d2fa
commit
f685bdca04
1 changed files with 51 additions and 38 deletions
|
|
@ -1,44 +1,57 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env, argv) => {
|
||||||
entry: './src/index.tsx',
|
const isProduction = argv.mode === 'production';
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, 'dist'),
|
return {
|
||||||
filename: 'bundle.js',
|
entry: './src/index.tsx',
|
||||||
clean: true,
|
output: {
|
||||||
publicPath: './',
|
path: path.resolve(__dirname, 'dist'),
|
||||||
},
|
filename: 'bundle.js',
|
||||||
resolve: {
|
clean: true,
|
||||||
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
||||||
},
|
// Empty string generates relative paths that work through proxies
|
||||||
module: {
|
publicPath: '',
|
||||||
rules: [
|
},
|
||||||
{
|
resolve: {
|
||||||
test: /\.tsx?$/,
|
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
||||||
exclude: /node_modules/,
|
},
|
||||||
use: 'ts-loader',
|
module: {
|
||||||
},
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.tsx?$/,
|
||||||
use: ['style-loader', 'css-loader', 'postcss-loader'],
|
exclude: /node_modules/,
|
||||||
},
|
use: 'ts-loader',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: ['style-loader', 'css-loader', 'postcss-loader'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
template: './src/index.html',
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
devServer: {
|
||||||
plugins: [
|
port: 3000,
|
||||||
new HtmlWebpackPlugin({
|
allowedHosts: 'all',
|
||||||
template: './src/index.html',
|
historyApiFallback: {
|
||||||
}),
|
index: 'index.html',
|
||||||
],
|
|
||||||
devServer: {
|
|
||||||
port: 3000,
|
|
||||||
allowedHosts: 'all',
|
|
||||||
historyApiFallback: true,
|
|
||||||
proxy: [
|
|
||||||
{
|
|
||||||
context: ['/api'],
|
|
||||||
target: 'http://localhost:8001',
|
|
||||||
},
|
},
|
||||||
],
|
// Disable WebSocket-based HMR for proxy compatibility
|
||||||
},
|
// VS Code web proxy sends WebSocket messages as Blobs which breaks HMR
|
||||||
|
webSocketServer: false,
|
||||||
|
hot: false,
|
||||||
|
liveReload: false,
|
||||||
|
proxy: [
|
||||||
|
{
|
||||||
|
context: ['/api'],
|
||||||
|
target: 'http://localhost:8001',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue