forked from CoinSpace/CoinSpace
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
90 lines (84 loc) · 2.21 KB
/
Copy pathwebpack.prod.js
File metadata and controls
90 lines (84 loc) · 2.21 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const autoprefixer = require('autoprefixer');
const Dotenv = require('dotenv-webpack');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const envFile = process.env.ENV_FILE ? process.env.ENV_FILE : '.env.prod';
var config = merge(common, {
output: {
publicPath: '/'
},
module: {
rules: [
{
test: /\.js$/,
include: [
/node_modules\/bech32/,
],
use: {
loader: 'babel-loader', // special for UglifyJSPlugin
options: {
presets: ['es2015'],
}
}
},
{
test: /\.(sass|scss)$/,
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
minimize: true
}
},
{
loader: 'postcss-loader',
options: {
plugins: [
autoprefixer
]
}
},
{
loader: 'sass-loader'
}
],
fallback: 'style-loader',
publicPath: '../../'
})
},
]
},
plugins: [
new CleanWebpackPlugin(['./build'], {verbose: false}),
new ProgressBarPlugin(),
new Dotenv({
path: envFile,
safe: true
}),
new UglifyJSPlugin({
mangle: {
except: ['BigInteger','ECPair','Point']
}
}),
new ExtractTextPlugin({
filename: 'assets/css/all.[contenthash:8].css',
allChunks: true,
})
]
});
if (process.env.BUILD_TYPE === 'phonegap') {
var htmlPlugin = config.plugins.find(function(plugin) {
return plugin instanceof HtmlWebpackPlugin;
});
htmlPlugin.options.chunks = ['deviceready'];
config.entry['deviceready'] = './phonegap/deviceready.js';
delete config.entry['loader'];
config.output.publicPath = '';
}
module.exports = config;