-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack-build.config.js
More file actions
118 lines (114 loc) · 2.85 KB
/
webpack-build.config.js
File metadata and controls
118 lines (114 loc) · 2.85 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* @author Kuitos
* @homepage https://github.com/kuitos/
* @since 2015-08-06
*/
var path = require('path');
var webpack = require('webpack');
var HTMLPlugin = require('html-webpack-plugin');
var autoprefixer = require('autoprefixer');
module.exports = {
devtool: 'source-map',
entry: ['webpack-hot-middleware/client?path=/__webpack_hmr&reload=true', './src/app/app.js'],
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
externals: {
'angular': 'angular',
'angular-resource': '\'ngResource\'',
'angular-ui-router': '\'ui.router\''
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new HTMLPlugin({
template: './src/index.html',
filename: 'index.html',
inject: false
}),
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
}),
new webpack.optimize.DedupePlugin(),
new webpack.NoErrorsPlugin()
],
resolve: {
extensions: ['', '.js']
},
eslint: {
configFile: '.eslintrc',
emitWarning: true,
emitError: true,
formatter: require('eslint-friendly-formatter')
},
postcss: [autoprefixer({browsers: ['Chrome > 35', 'Firefox > 30', 'Safari > 7']})],
module: {
preLoaders: [
{
test: /\.js?$/,
loader: 'eslint-loader',
exclude: /node_modules/,
include: path.join(__dirname, 'src')
}
],
loaders: [
{
test: /\.js?$/,
loaders: ['babel'],
exclude: /(node_modules|bower_components)/,
include: [path.join(__dirname, 'src'), path.join(__dirname, 'demo')]
},
{
test: /\.tpl\.html$/,
loader: 'html',
query: {interpolate: true},
exclude: /(node_modules|bower_components)/,
include: path.join(__dirname, 'src/components')
},
{
test: /.html$/,
loader: 'file?name=[path][name]-[hash:8].[ext]',
exclude: /(node_modules|bower_components)/,
include: path.join(__dirname, 'src/app')
},
{
test: /\.css$/,
loaders: ['style', 'css', 'postcss', 'resolve-url'],
exclude: /(node_modules|bower_components)/
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'postcss', 'resolve-url', 'sass?sourceMap'],
exclude: /(node_modules|bower_components)/
},
{
test: /\.(jpe?g|png|gif)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash:8].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
{
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=15000&mimetype=application/font-woff&prefix=fonts'
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=15000&mimetype=application/octet-stream&prefix=fonts'
},
{
test: /\.eot(\?#\w+)?$/,
loader: 'url?limit=15000&mimetype=application/vnd.ms-fontobject&prefix=fonts'
},
{
test: /\.svg(#\w+)?$/,
loader: 'url?limit=15000&mimetype=image/svg+xml&prefix=fonts'
}
]
}
};