forked from DoclerLabs/RealTimeChart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
56 lines (54 loc) · 1.33 KB
/
webpack.prod.js
File metadata and controls
56 lines (54 loc) · 1.33 KB
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
var webpack = require('webpack');
var path = require('path');
var PACKAGE = require('./package.json');
var PACKAGE_NAME = PACKAGE.name + '-' + PACKAGE.version;
var BUILD_DIR = path.resolve(__dirname, 'bundle');
var APP_DIR = path.resolve(__dirname, 'src');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var pathsToClean = ['bundle/'];
var cleanOptions = {
root: __dirname,
verbose: true,
};
var config = {
entry: './index.js',
output: {
path: BUILD_DIR, //Path where the bundle should be exported
filename: PACKAGE_NAME + '.js', //Filename
publicPath: '/', //Where the js gets loaded from
},
module: {
rules: [
{
test: /\.json$/,
enforce: 'pre',
use: 'json-loader',
},
{
test: /\.jsx?/,
include: APP_DIR,
use: ['babel-loader'],
exclude: /(node_modules|bower_components)/,
},
],
},
resolve: {
modules: [path.join(__dirname, 'src'), 'node_modules'],
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
output: {
comments: false,
},
compressor: {
warnings: false,
screw_ie8: true,
},
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new CleanWebpackPlugin(pathsToClean, cleanOptions),
],
};
module.exports = config;