-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
45 lines (44 loc) · 1.04 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
const webpack = require('webpack');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const { name: pkgName } = require('./package.json');
module.exports = {
devtool: 'source-map',
target: 'node',
node: {
__dirname: false,
},
externals: [nodeExternals()],
entry: {
cli: path.join(__dirname, 'src', 'cli.js'),
'cambridge-dictionary': path.join(__dirname, 'src', 'index.js'),
},
output: {
path: path.join(__dirname, 'lib'),
filename: '[name].js',
libraryTarget: 'umd',
library: pkgName,
},
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 UglifyJSPlugin({
sourceMap: true,
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
}),
],
};