-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-module.config.js
37 lines (34 loc) · 981 Bytes
/
webpack-module.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
'use strict';
const {resolve} = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const outputPath = resolve('dist');
const IS_DEV_SERVER = process.argv.find(arg => arg.includes('webpack-dev-server'));
module.exports = () => {
return {
module: {
rules: [
{
test: /\.js$/,
// We need to transpile Polymer itself and other ES6 code
// exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [[
'env',
{
targets: {browsers: ['last 2 Chrome versions', 'Safari 10', 'ie >= 11']},
debug: true
}
]],
plugins: [['transform-object-rest-spread', {useBuiltIns: true}]]
}
}
}
]
},
plugins: IS_DEV_SERVER ? [] : [
new CleanWebpackPlugin([outputPath], {verbose: true})
]
};
};