-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.config.js
More file actions
64 lines (60 loc) · 1.46 KB
/
webpack.config.js
File metadata and controls
64 lines (60 loc) · 1.46 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
61
62
63
64
const webpack = require('webpack')
const path = require('path')
var PACKAGE = require('./package.json')
const year = new Date().getFullYear()
var banner = `${PACKAGE.name} - ${PACKAGE.version} (c) ${year}, ${PACKAGE.author} |
${PACKAGE.license} | ${PACKAGE.homepage}`
module.exports = (env) => {
const BUNDLE = env.BUNDLE === 'true';
const MINIFY = env.MINIFY === 'true';
let fileDest = `checkforce`;
const externals = {
'@popperjs/core': 'Popper',
'zxcvbn': 'zxcvbn'
};
if (BUNDLE) {
fileDest += '.bundle'
// Remove
delete externals['@popperjs/core']
delete externals['zxcvbn']
}
return {
entry: './src/index.js',
mode: MINIFY ? 'production' : 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: MINIFY ? `${fileDest}.min.js` : `${fileDest}.js`,
library: {
name: 'CheckForce',
type: 'umd'
},
libraryExport: 'default',
publicPath: '/'
},
devtool: 'source-map',
externals: externals,
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
devServer: {
static: {
directory: path.join(__dirname, './'),
},
port: 9000
},
plugins: [
new webpack.BannerPlugin(banner)
]
}
}