1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-25 23:09:22 +00:00
comunicapiv2/webpack.config.js

48 lines
792 B
JavaScript
Raw Normal View History

2019-11-21 16:04:15 +00:00
const path = require("path");
2019-11-21 16:20:21 +00:00
const nodeExternals = require("webpack-node-externals");
const WebpackShellPlugin = require("webpack-shell-plugin");
2019-11-21 16:04:15 +00:00
const {
NODE_ENV = 'production'
} = process.env;
module.exports = {
entry: './src/main.ts',
mode: NODE_ENV,
target: 'node',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.js'
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
2019-11-21 16:20:21 +00:00
// Support for TS files
2019-11-21 16:04:15 +00:00
{
test: /\.ts$/,
use: [
'ts-loader'
]
}
]
},
2019-11-21 16:20:21 +00:00
plugins: [
// Allow live-reload
new WebpackShellPlugin({
onBuildEnd: ["node_modules/.bin/nodemon build/main.js"]
})
],
// Split dependencies and source code
externals: [nodeExternals()],
2019-11-21 16:04:15 +00:00
2019-11-21 16:20:21 +00:00
// Auto-watch in dev env
2019-11-21 16:04:15 +00:00
watch: NODE_ENV === 'development'
}