-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
104 lines (92 loc) · 2.14 KB
/
webpack.config.dev.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
'use strict';
const NODE_ENV = process.env.NODE_ENV || 'development';
const path = require('path'),
webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
ExtractTextPlugin = require('extract-text-webpack-plugin');
let APP = __dirname + '/src';
module.exports = {
cache: true,
entry: {
app: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8081',
APP + '/index.js'
],
vendors: [
'angular/angular.js',
'baobab',
'livr',
'angular-route',
'angular-animate',
'angular-sanitize',
'angular-material',
'angular-data-table/release/dataTable.helpers.js',
'angular-file-upload',
'superagent',
],
},
output: {
path: __dirname + '/public',
filename: '[name].[hash].js'
},
resolve: {
root: path.resolve(APP)
},
watch: true,
watchOptions: {
aggregateTimeout: 100
},
module: {
preLoaders: [],
loaders: [
{
test: /\.js$/,
loader: 'babel?presets[]=es2015',
exclude: /node_modules/
},
{
test: /\.less$/,
loader: 'style!css?modules&importLoaders=1&localIdentName=[name]_[local]_[hash:base64:5]!less'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css'
)
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?name=assets/[hash][name].[ext]&limit=10000&mimetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader?name=assets/[hash][name].[ext]'
},
{
test: /\.jpg|\.png|\.mp3/,
loader: 'file-loader?name=assets/[hash][name].[ext]'
},
{
test: /\.html$/,
loader: 'raw'
},
]
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify(NODE_ENV)
}),
new HtmlWebpackPlugin({
template: APP + '/index.html',
inject: 'body'
}),
new webpack.optimize.CommonsChunkPlugin(
'vendors', 'vendors.[hash].js'
),
new ExtractTextPlugin('common.[hash].css', { allChunks: true })
],
devtool: 'cheap-inline-module-source-map'
};