-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
116 lines (112 loc) · 3.31 KB
/
webpack.config.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
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
var path = require('path'),
webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
OpenBrowserPlugin = require('open-browser-webpack-plugin'),
ExtractTextPlugin = require("extract-text-webpack-plugin");
const paths = {
context: path.join(__dirname, '/src'),
build: path.join(__dirname, '/build'),
nodeModules: path.join(__dirname, '/node_modules')
};
var config = {
context: paths.context,
entry: {
app: [
'./scripts/core/bootstrap.js'
],
vendor: [
'angular',
'angular-ui-router',
'angular-ui-bootstrap',
'oclazyload',
'lodash',
'font-awesome/scss/font-awesome.scss',
'./styles/main.scss',
'bootstrap-webpack!./styles/config/bootstrap.config.js'
]
},
output: {
path: paths.build,
filename: 'app.bundle.[hash].js',
chunkFilename: "[name].bundle.[hash].js",
sourceMapFilename: '[file].map'
},
module: {
loaders: [{
test: /\.html$/,
loader: 'html'
}, {
test: /\.js$/,
loader: 'ng-annotate'
}, {
test: /\.css$/,
loader: "style!css?sourceMap"
}, {
test: /\.less$/,
loader: 'style!css?sourceMap!less'
}, {
test: /\.scss$/,
loader: 'style!css?sourceMap!sass'
}, {
test: /\.json$/,
loader: 'json'
}, {
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=application/font-woff&name=./fonts/[hash].[ext]'
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=application/octet-stream&name=./fonts/[hash].[ext]'
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file?name=./fonts/[hash].[ext]'
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=image/svg+xml&name=./imgs/[hash].[ext]'
}, {
test: /\.(jpe?g|png|gif)$/i,
loader: 'file?hash=sha512&digest=hex&name=./imgs/[hash].[ext]'
}],
},
plugins: [
new OpenBrowserPlugin(),
new HtmlWebpackPlugin({
inject: true,
showErrors: true,
title: 'COACH OC',
template: './index.ejs',
favicon: './imgs/favicon.png'
}),
new webpack.DefinePlugin({
PROCESS_CWD: JSON.stringify(process.cwd())
}),
new webpack.EnvironmentPlugin([
"NODE_ENV"
]),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: "[name].bundle.[hash].js",
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false,
}
}),
new webpack.HotModuleReplacementPlugin()
],
resolve: {
alias: {
loader$: paths.context + "/scripts/core/loader.js"
}
},
devtool: "#eval",
devServer: {
hot: true,
inline: true
}
};
module.exports = config;
//https://webpack.github.io/analyse/