-
Notifications
You must be signed in to change notification settings - Fork 16
/
webpack.config.js
68 lines (59 loc) · 1.81 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
var Webpack = require('webpack');
var StatsPlugin = require('stats-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var autoprefixer = require('autoprefixer-core');
var csswring = require('csswring');
var path = require('path');
var nodeModulesPath = path.resolve(__dirname, 'node_modules');
var assetsPath = path.resolve(__dirname, 'public', 'assets');
var entryPath = path.resolve(__dirname, 'frontend', 'app.es6.js');
var host = process.env.APP_HOST || 'localhost';
var config = {
// Makes sure errors in console map to the correct file
// and line number
devtool: 'eval',
entry: [
// For hot style updates
'webpack/hot/dev-server',
// The script refreshing the browser on none hot updates
'webpack-dev-server/client?http://' + host + ':3001',
// Our application
entryPath
],
output: {
path: assetsPath,
filename: 'bundle.js'
},
module: {
loaders: [
{ test: /\.es6.js$/, loader: 'babel-loader' },
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('css?sourceMap!postcss-loader?sourceMap')
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('css?sourceMap!postcss-loader?sourceMap!less?sourceMap')
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
}
]
},
postcss: [autoprefixer, csswring],
plugins: [
// We have to manually add the Hot Replacement plugin when running
// from Node
new ExtractTextPlugin("styles.css"),
new Webpack.HotModuleReplacementPlugin()
]
};
module.exports = config;