-
Notifications
You must be signed in to change notification settings - Fork 12
/
webpack.config.prod.babel.js
80 lines (77 loc) · 1.84 KB
/
webpack.config.prod.babel.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import autoprefixer from 'autoprefixer';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
const webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
background: [
'babel-polyfill',
'./src/assets/js/background/background.js',
'./src/assets/js/background/hot-reload.js',
],
content_script: [
'babel-polyfill',
'./src/assets/js/content_scripts/main.js'],
},
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
},
],
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.styl$/,
loader: ExtractTextPlugin
.extract(
'style-loader', 'css-loader?modules!postcss-loader!stylus-loader'),
},
{
test: /\.json$/,
loader: 'json-loader',
},
{
test: /\.(eot|otf|woff|woff2|ttf|svg)$/,
loader: 'url-loader?limit=30000&name=[name].[ext]',
},
{
test: /\.(png|jpg)$/,
loader: 'file-loader?name=[path][name].[ext]',
},
],
},
output: {
filename: '[name].js',
path: path.resolve('dist'),
publicPath: path.resolve('/'),
},
postcss() {
return [autoprefixer({
browsers: ['last 2 versions', 'ie >= 9'],
remove: false,
})];
},
plugins: [
// Optimizes the order that the files are bundled
new webpack.optimize.OccurenceOrderPlugin(),
new ExtractTextPlugin('main.css'),
// Eliminates duplicated packages when generating bundle
new webpack.optimize.DedupePlugin(),
// Uglify bundle
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
}),
],
resolve: {
extensions: ['', '.js', '.styl'],
},
};