-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
63 lines (57 loc) · 1.7 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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const packages = require('./package.json');
//Paths
const path = require('path');
const outFolder = path.resolve(__dirname, './wwwroot');
//Configuration values depending on environment
const entryPoint = './app/app.js';
const plugins = [
new HtmlWebpackPlugin({
template: __dirname + '/index.tmpl.html',
hash: true
}),
new ExtractTextPlugin('style-bundle-[hash].css', {
allChunks: true
}),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor-[hash].js', Infinity),
new webpack.HotModuleReplacementPlugin()
];
const appFolder = /app/;
const debugPort = 3000;
const configuration = {
devtool: 'eval',
debug: true,
entry: {
app: ['webpack-dev-server/client?http://localhost:' + debugPort + '/',
'webpack/hot/only-dev-server', entryPoint
],
vendor: Object.keys(packages.dependencies)
},
output: {
path: outFolder,
filename: 'app-bundle-[hash].js'
},
plugins: plugins,
module: {
preLoaders: [{
test: /\.(js|jsx)$/,
loader: 'eslint',
include: appFolder
}],
loaders: [{
test: /\.(js|jsx)$/,
loader: 'babel',
include: appFolder
}, {
test: /\.(scss|sass)$/,
loaders: ['style', 'css?modules&importLoaders=1', 'postcss', 'sass'],
include: appFolder
}]
},
postcss: [autoprefixer],
debugPort: debugPort
}
module.exports = configuration;