-
Notifications
You must be signed in to change notification settings - Fork 178
/
webpack.config.js
45 lines (44 loc) · 1.57 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
var debug = process.env.NODE_ENV !== "prod";
var webpack = require('webpack');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var copyPatterns = [
{ from: "./manifest.json", to: "../manifest.json" },
{ from: "./img", to: "../img" },
{ from: "./css", to: "../css" },
{ from: "./views", to: "../views" }
];
module.exports = {
context: __dirname + "/src",
devtool: debug ? "inline-sourcemap" : null,
entry: {
content: "./js/content.js",
background: "./js/background.js",
me: "./js/views/me.js",
manage: "./js/views/manage.js",
options: "./js/views/options.js",
popup: "./js/views/popup.js"
},
output: {
path: __dirname + "/build/js",
filename: "[name].js"
},
module: {
loaders: [{
test: /\.scss$/,
loaders: ["style-loader", "css-loader", "sass-loader"]
}]
},
plugins: debug ? [
new CleanWebpackPlugin(['build']),
new webpack.ProvidePlugin({ '$': 'jquery', 'Dexie': 'dexie', 'moment': 'moment', '_': 'lodash' }),
new CopyWebpackPlugin(copyPatterns)
] : [
new CleanWebpackPlugin(['build']),
new webpack.ProvidePlugin({ '$': 'jquery', 'Dexie': 'dexie', 'moment': 'moment', '_': 'lodash' }),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false, compress: false }),
new CopyWebpackPlugin(copyPatterns),
],
};