-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
39 lines (37 loc) · 1.08 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
var path = require('path');
var webpack = require('webpack');
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var ReplaceBundleStringPlugin = require('replace-bundle-webpack-plugin');
module.exports = {
devtool: 'source-map',
entry: './src/app.js',
output: {
path: path.resolve(__dirname, 'extension'),
filename: 'app.js',
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new ReplaceBundleStringPlugin([{
// Tern uses an older version of Acorn, which embeds an invalid UTF-8 character
// Chrome doesn't want to load the content script because of that
// So we replace the character literal with a fromCharCode call
partten: /\"\\uffff\"/g,
replacement: function () {
return "String.fromCharCode(65535)";
}
}])
],
};
if (process.env.NODE_ENV === 'production') {
module.exports.plugins.push(
new UglifyJSPlugin({
sourceMap: true,
uglifyOptions: {
mangle: false,
output: {
beautify: true
}
}
})
);
}