-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (46 loc) · 1.5 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
var fs = require('fs'),
path = require('path'),
webpack = require('webpack');
module.exports = {
devtool:'inline-source-map',
entry:
[
'webpack-dev-server/client/?http://127.0.0.1:9090',
'webpack/hot/only-dev-server',
'./src/app.js',
'./src/print.js'
],
output:{
path:__dirname+'/public/js',
filename:'[name].js',
chunkFilename:'[id].chunk.js',
publicPath:'http://127.0.0.1:9090/public/js'
},
resolve:{
root:[process.cwd()+'/src', process.cwd() + '/node_modules'],
extensions:['', '.js', '.css', '.scss', '.ejs', '.png', '.jpg']
},
module:{
loaders:[
{test:/\.js$/, exclude:/node_modules/,loader:'babel-loader?presets[]=es2015&presets[]=react&presets[]=stage-0'},
{test:/\.css$/,loader:'style!css'},
{test: /\.scss$/, loader: 'style!css!scss'},
{
test: /.*\.(gif|png|jpe?g|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}'
]
}
]
},
plugins:[
new webpack.ProvidePlugin({
$:'jquery',
jQuery: "jquery",
"window.jQuery": "jquery"
}),
new webpack.optimize.CommonsChunkPlugin('shared.js'),
new webpack.HotModuleReplacementPlugin()
]
};