-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
62 lines (61 loc) · 1.94 KB
/
webpack.dev.config.js
File metadata and controls
62 lines (61 loc) · 1.94 KB
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
var path = require('path');
var webpack = require('webpack');
// var ExtractTextPlugin = require('extract-text-webpack-plugin');
var cssimport = require('postcss-import');
var autoprefixer = require('autoprefixer-core');
module.exports = {
devtool: 'cheap-module-eval-source-map',
// devtool: 'eval-source-map',
entry: {
main: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./src/index.js'
],
common: ['react', 'd3', 'leaflet', 'whatwg-fetch', 'redux']
},
debug: true,
output: {
path: path.join(__dirname, 'dataproduct'),
filename: 'loader.js',
chunkFilename: '[name].js',
publicPath: '/dataproduct/',
pathinfo: true
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({ __DEV__: 'true' }),
new webpack.optimize.CommonsChunkPlugin('common', 'common.bundle.js')
],
resolve: {
extensions: ['', '.js'],
alias: {
react: path.join(__dirname, 'node_modules', 'react'),
context$: '../dev_context'
}
},
postcss: function () {
return [
cssimport({
onImport: function (files) {
files.forEach(this.addDependency);
}.bind(this)
}),
autoprefixer
];
},
module: {
loaders: [
{ test: /\.js$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/ },
{ test: /\.json$/, loader: 'json-loader', exclude: /node_modules/ },
{ test: /\.(png|jpg|gif)$/, loader: 'url-loader?limit=8192'},
{ test: /App.css$/, exclude: /node_modules/,
loaders: ['style-loader',
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]','postcss-loader']
// loader: ExtractTextPlugin.extract('style-loader',
// 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader')
},
]
}
};