2023-12-01 15:49:39 +00:00
|
|
|
const path = require('path');
|
|
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
|
|
const OUTPUT = "build";
|
|
|
|
|
2023-12-03 08:58:54 +00:00
|
|
|
import { installMiddlewares } from './mock/webpack.farpatch';
|
|
|
|
|
2023-12-01 15:49:39 +00:00
|
|
|
module.exports = {
|
|
|
|
mode: 'development',
|
|
|
|
entry: path.resolve(__dirname, './src/index.ts'),
|
|
|
|
plugins: [
|
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{ from: "static", to: path.resolve(__dirname, OUTPUT) },
|
2023-12-03 08:58:54 +00:00
|
|
|
{ from: "node_modules/xterm/css/xterm.css", to: path.resolve(__dirname, OUTPUT, 'css') }
|
2023-12-01 15:49:39 +00:00
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
performance: {
|
2023-12-03 08:58:54 +00:00
|
|
|
maxAssetSize: 512000
|
2023-12-01 15:49:39 +00:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: 'ts-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js'],
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: 'main.js',
|
|
|
|
path: path.resolve(__dirname, OUTPUT),
|
|
|
|
},
|
2023-12-03 08:58:54 +00:00
|
|
|
devServer: {
|
2023-12-03 11:35:34 +00:00
|
|
|
allowedHosts: 'all',
|
2023-12-03 08:58:54 +00:00
|
|
|
static: {
|
|
|
|
directory: path.resolve(__dirname, OUTPUT),
|
|
|
|
},
|
|
|
|
compress: true,
|
|
|
|
port: 9000,
|
|
|
|
setupMiddlewares: (middlewares: any, devServer: any) => {
|
|
|
|
if (!devServer) {
|
|
|
|
throw new Error('webpack-dev-server is not defined');
|
|
|
|
}
|
|
|
|
|
|
|
|
installMiddlewares(devServer.app);
|
|
|
|
return middlewares;
|
|
|
|
}
|
|
|
|
},
|
2023-12-01 15:49:39 +00:00
|
|
|
};
|