-
Notifications
You must be signed in to change notification settings - Fork 221
/
webpack.config.js
47 lines (46 loc) · 1.06 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
37
38
39
40
41
42
43
44
45
46
47
const webpack = require('webpack');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
module.exports = {
target: 'node',
node: {
__dirname: false,
},
externals: [nodeExternals()],
entry: {
cli: path.join(__dirname, 'src', 'cli.js'),
},
output: {
path: path.join(__dirname, 'lib'),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: path.resolve(__dirname, 'node_modules'),
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
}),
new CopyWebpackPlugin([
{
from: path.join(__dirname, 'src', 'utils', 'fonts'),
to: path.join(__dirname, 'lib', 'fonts'),
},
]),
],
optimization: {
minimizer: [new TerserPlugin()],
},
};