2024-12-04 21:38:21 +01:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
2023-12-23 01:59:00 +01:00
|
|
|
const path = require('path');
|
|
|
|
|
2024-12-04 21:38:21 +01:00
|
|
|
const isDevServer = process.env.WEBPACK_SERVE;
|
|
|
|
console.log("Dev server is " + isDevServer);
|
|
|
|
var host;
|
|
|
|
if (isDevServer){
|
|
|
|
host = 'http://10.23.43.24';
|
|
|
|
} else {
|
|
|
|
host = '';
|
|
|
|
}
|
|
|
|
|
2023-12-23 01:59:00 +01:00
|
|
|
module.exports = {
|
|
|
|
mode: "development",
|
2024-12-11 21:01:11 +01:00
|
|
|
entry: ['./src/index.ts'],
|
2023-12-23 01:59:00 +01:00
|
|
|
devtool: 'inline-source-map',
|
2024-12-04 21:38:21 +01:00
|
|
|
plugins: [
|
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: "src/index.html",
|
|
|
|
to: "index.html"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
PUBLIC_URL: JSON.stringify(host),
|
|
|
|
}),
|
|
|
|
new webpack.EnvironmentPlugin({
|
|
|
|
redirect: 'true'
|
|
|
|
})
|
|
|
|
|
|
|
|
],
|
2023-12-23 01:59:00 +01:00
|
|
|
module: {
|
|
|
|
rules: [
|
2024-12-11 21:01:11 +01:00
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
type: 'asset/source'
|
|
|
|
},
|
2023-12-23 01:59:00 +01:00
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: 'ts-loader',
|
|
|
|
exclude: /node_modules/,
|
2024-12-11 21:01:11 +01:00
|
|
|
}
|
2023-12-23 01:59:00 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
2024-12-11 21:01:11 +01:00
|
|
|
extensions: ['.tsx', '.ts', '.js', '.html'],
|
2023-12-23 01:59:00 +01:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: 'bundle.js',
|
|
|
|
path: path.resolve(__dirname, '../src/webserver'),
|
|
|
|
},
|
2024-12-04 21:38:21 +01:00
|
|
|
devServer: {
|
|
|
|
}
|
2023-12-23 01:59:00 +01:00
|
|
|
};
|