-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.prod.js
71 lines (70 loc) · 1.61 KB
/
webpack.config.prod.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
const path = require('path');
const libPath = path.join(__dirname, 'src');
const wwwPath = path.join(__dirname, 'build');
const pkg = require('./package.json');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: ['includes.js', path.join(libPath, 'ts/index.ts')],
context: libPath,
output: {
path: wwwPath,
filename: 'app-[hash:6].js',
},
node: {
fs: "empty"
},
module: {
loaders: [{
test: /\.tsx?$/,
loaders: [
'babel-loader',
'ts-loader',
]
},{
test: /\.html$/,
loader: 'html',
}, {
test: /\.json$/,
loader: 'json',
}, {
test: /\.(png|jpg)$/,
loader: 'file?name=img/[name].[ext]',
}, {
test: /\.css$/,
loader: 'style-loader!css-loader!postcss-loader',
}, {
test: /\.scss$/,
loader: 'style!css!autoprefixer!sass',
}, {
test: /\.js$/,
exclude: /(node_modules|vendor|src\/lib)/,
loaders: ['babel-loader'],
},
],
},
resolve: {
extensions: ['.js', '.json', '.scss', '.html', '.ts'],
/*root: [
libPath,
path.join(__dirname, 'node_modules'),
],*/
modules: [
libPath,
'node_modules'
]
},
plugins: [
new HtmlWebpackPlugin({
COMPILE_ENV: process.env.COMPILE_ENV,
pkg,
hash: Math.random().toString(36).substring(4),
template: path.join(libPath, 'index.ejs'),
}),
new webpack.optimize.UglifyJsPlugin({ output: {comments: false} }),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
],
};