-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
75 lines (74 loc) · 2.36 KB
/
webpack.config.babel.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
72
73
74
75
import BitBarWebpackProgressPlugin from 'bitbar-webpack-progress-plugin';
import path from 'path';
import CommonsChunkPlugin from 'webpack/lib/optimize/CommonsChunkPlugin';
import NoErrorsPlugin from 'webpack/lib/NoErrorsPlugin';
import HotModuleReplacementPlugin from 'webpack/lib/HotModuleReplacementPlugin';
import DefinePlugin from 'webpack/lib/DefinePlugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ShellPlugin from 'webpack-shell-plugin';
export default {
context: path.join(__dirname, 'src'),
entry: {
init: './init.js',
vendor: []
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
include: /src/,
loaders: ['ng-annotate', 'babel-loader']
},
{
test: /\.scss$/,
include: /src/,
loaders: [
'style-loader',
'css-loader?modules&localIdentName=[name]---[local]---[hash:base64:5]',
'sass-loader?outputStyle=expanded&' +
'includePaths[]=' + path.join(__dirname + 'node_modules')
]
},
{
test: /\.(png|jpg|jpeg|gif)$/i,
loader: "url-loader?limit=100000"
},
{
test: /\.html$/,
exclude: /node_modules/,
// loader: 'raw'
loader: 'html?attrs=false'
}
]
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
inline: true,
stats: 'errors-only'
},
plugins: [
new BitBarWebpackProgressPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src', 'index.html'),
hash: true
}),
new HotModuleReplacementPlugin(),
new NoErrorsPlugin(),
new CommonsChunkPlugin({
minChunks: 2,
name: ['commons', 'vendor', 'bootstrap']
}),
new ShellPlugin({
onBuildStart: ['echo "Starting Webpack..."', 'echo "Cleaning build folder..."', 'rm -rf dist']
}),
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
debug: true,
devtool: 'eval-source-map'
}