-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
50 lines (47 loc) · 1.03 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
const webpack = require('webpack');
const path = require('path')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const pkg = require('./package.json')
const banner = `
${pkg.description}
v${pkg.version} ©${new Date().getFullYear()} ${pkg.author}
${pkg.homepage}
`.trim()
function resolve (dir, filename = '') {
return path.join(__dirname, dir, filename)
}
const config = {
entry: './index.js',
output: {
path: resolve('dist'),
publicPath: '/',
library: 'showToast',
libraryTarget: 'umd',
filename: 'show-toast.js'
},
module: {
rules: [
{
enforce: 'pre',
test: /\.(js)$/,
use: [{
loader: 'eslint-loader',
options: {
fix: true
}
}]
},
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader']
},
]
},
plugins: [
new CleanWebpackPlugin([resolve('dist')]),
new webpack.optimize.UglifyJsPlugin(),
new webpack.BannerPlugin(banner),
]
}
module.exports = config;