-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebpack.config.js
36 lines (35 loc) · 1.09 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const Dotenv = require('dotenv-webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
mode: 'production',
target: 'node',
entry: {
index: path.resolve(__dirname, './server.js'),
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
clean: true,
},
externals: [nodeExternals()],
plugins: [new Dotenv(), new CleanWebpackPlugin()],
resolve: {
alias: {
config: path.resolve(__dirname, './app/config'),
controllers: path.resolve(__dirname, './app/controllers'),
i18n: path.resolve(__dirname, './app/i18n'),
helpers: path.resolve(__dirname, './app/helpers'),
middleware: path.resolve(__dirname, './app/middleware'),
models: path.resolve(__dirname, './app/models'),
routes: path.resolve(__dirname, './app/routes'),
},
modules: ['node_modules'],
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
};