forked from vulcanize/dxns-registry-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
64 lines (52 loc) · 1.35 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// Copyright 2019 Wireline, Inc.
//
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
const mode = process.env.NODE_ENV || 'development';
module.exports = {
target: 'web',
mode,
stats: 'errors-only',
// Source map shows the original source and line numbers (and works with hot loader).
// https://webpack.github.io/docs/configuration.html#devtool
devtool: process.env.NODE_ENV !== 'production' ? '#source-map' : false,
entry: {
index: [path.resolve('./src/index.js')]
},
output: {
path: path.resolve(__dirname, 'dist/umd'),
filename: '[name].js',
libraryTarget: 'umd'
},
externals: Object.keys(pkg.dependencies),
// https://www.npmjs.com/package/html-webpack-plugin
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
})
].filter(Boolean),
module: {
rules: [
// js/mjs
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: { chrome: "60" } }]
]
}
}
},
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto'
}
]
}
};