-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
60 lines (58 loc) · 1.35 KB
/
webpack.config.js
File metadata and controls
60 lines (58 loc) · 1.35 KB
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
const pkg = require('./package.json'),
args = require('yargs').argv,
env = args.env === 'dev' ? 'development' : 'production',
packageName = `${pkg.name}.min.js`,
HtmlWebpackPlugin = require('html-webpack-plugin');
console.log(`BUILD ENVIRONMENT: ${env}`);
console.log(`PACKAGE NAME: ${packageName}`);
module.exports = {
mode: env,
entry: [ 'babel-polyfill', `${__dirname}/src/sdk.js` ],
devtool: 'source-map',
output: {
path: `${__dirname}/lib`,
filename: packageName,
library: `SwillSDK`,
libraryTarget: 'umd',
umdNamedDefine: true,
globalObject: 'this'
},
devServer: {
compress: true,
host: '0.0.0.0',
port: 8080
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: ['transform-runtime'],
presets: ['env', 'stage-0']
}
}
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader'
}
]
},
performance: {
hints: false
},
stats: {
colors: true
},
plugins: [
env === 'development' ? new HtmlWebpackPlugin({
hash: true,
title: 'Swill SDK Development App',
filename: 'index.html'
}) : () => {},
]
};