added webpack.js

This commit is contained in:
Daniel Hübleitner
2019-09-18 07:35:31 +02:00
parent 7ff0d1e67e
commit e3f09335d8
2 changed files with 168 additions and 0 deletions
+67
View File
@@ -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]