added webpack.js
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
const path = require('path');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
|
||||
const frontendConf = {
|
||||
mode: 'production',
|
||||
target: "web",
|
||||
entry: path.resolve(__dirname, 'src', 'Frontend.ts'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'lib'),
|
||||
filename: "Frontend.js",
|
||||
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",
|
||||
entry: path.resolve(__dirname, 'src', 'Backend.ts'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'lib'),
|
||||
filename: "Backend.js",
|
||||
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/,
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = [frontendConf, backendConf]
|
||||
Reference in New Issue
Block a user