123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- const path = require('path');
- const TerserPlugin = require('terser-webpack-plugin');
-
-
- const frontendConf = {
- mode: 'production',
- target: "web",
- output: {
- path: path.resolve(__dirname, 'lib'),
- libraryTarget: 'commonjs',
- },
- module: {
- rules: [
- { test: /\.ts?$/, loader: "ts-loader" }
- ]
- },
- resolve: {
- extensions: [".ts", ".tsx", ".js"]
- },
- optimization: {
- minimize: true,
- minimizer: [
- new TerserPlugin({
- parallel: true,
- exclude: [
- /\.\/(.*)\/.ts/,
- /\.\/(.*).ts/,
- ],
- }),
- ],
- },
- }
-
- const backendConf = {
- mode: 'production',
- target: "node",
- output: {
- path: path.resolve(__dirname, 'lib'),
- libraryTarget: 'commonjs',
- },
- module: {
- rules: [
- { test: /\.ts?$/, loader: "ts-loader" }
- ]
- },
- resolve: {
- extensions: [".ts", ".tsx", ".js"]
- },
- optimization: {
- minimize: true,
- minimizer: [
- new TerserPlugin({
- parallel: true,
- exclude: [
- /\.\/(.*)\/.ts/,
- /\.\/(.*).ts/,
- ],
- }),
- ],
- },
- }
-
- const clientConf = {
- ...frontendConf,
- ...{
- entry: path.resolve(__dirname, 'src', 'Client.ts'),
- output: {
- filename: 'Frontend.js',
- }
- }
- }
- const clientTestConf = {
- ...frontendConf,
- ...{
- entry: path.resolve(__dirname, 'test', 'TestClient.ts'),
- output: {
- filename: 'TestFrontend.js',
- }
- }
- }
-
- const serverConf = {
- ...backendConf,
- ...{
- entry: path.resolve(__dirname, 'src', 'Server.ts'),
- output: {
- filename: 'Backend.js',
- }
- }
- }
- const serverTestConf = {
- ...backendConf,
- ...{
- entry: path.resolve(__dirname, 'test', 'TestServer.ts'),
- output: {
- filename: 'TestBackend.js',
- }
- }
- }
-
- module.exports = [clientConf, clientTestConf, serverConf, serverTestConf]
|