-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.config.js
More file actions
47 lines (43 loc) · 976 Bytes
/
webpack.prod.config.js
File metadata and controls
47 lines (43 loc) · 976 Bytes
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
37
38
39
40
41
42
43
44
45
46
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserWebpackPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
console.info('loading webpack production environment - server');
module.exports = {
mode: 'production',
entry: './app.js',
target: 'node',
node: {
__dirname: false,
__filename: false,
},
module: {
rules: [
{
test: /\.node$/,
use: 'native-ext-loader',
},
],
},
output: {
path: path.join(__dirname, 'build'),
publicPath: '/',
filename: 'server.js',
libraryTarget: 'umd',
},
resolve: {
modules: ['node_modules'],
},
optimization: {
minimizer: [
new TerserWebpackPlugin(),
],
},
plugins: [
// /* Delete Distribution before building it */
new CleanWebpackPlugin(),
new CopyWebpackPlugin([
{ from: './index.html', to: '' },
]),
],
};