-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
67 lines (63 loc) · 1.91 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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebPackPlugin = require('html-webpack-plugin');
var WebpackNotifierPlugin = require('webpack-notifier');
var nodeDir = path.resolve(__dirname, 'node_modules');
var port = 8080;
var env = process.env.NODE_ENV;
var templateFile = 'template';
var config = {
port: port,
devTool: 'eval',
eslint: {
configFile: './.eslintrc'
},
entry: {
app: [
'webpack-dev-server/client?http://localhost:' + port,
'webpack/hot/only-dev-server',
path.resolve(__dirname, 'src/index.js')
],
vendors: ['react']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[hash].js',
hash: true,
publicPath: '/'
},
plugins: [
new HtmlWebPackPlugin({
title: 'Gadfly',
template: 'src/' + templateFile + '.html',
inject: 'body',
filename: 'index.html',
}),
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new WebpackNotifierPlugin({title: 'Webpack'}),
new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.BUILD_DEV || 'true')),
brainspaceHost: JSON.stringify(process.env.HOST || 'http://pdlsdev01:8080')
})
],
module: {
preLoaders: [
{test: /\.(js|jsx)?$/, loader: "eslint-loader", exclude: /node_modules/}
],
loaders: [
{ test: /\.(js|jsx)$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader') }
]
},
postcss: [
require('autoprefixer'),
require('postcss-color-rebeccapurple')
],
resolve: {
extensions: ['', '.js', '.jsx']
},
};
module.exports = config;