-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.example.config.js
45 lines (39 loc) · 1.1 KB
/
webpack.example.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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
const DEBUG = !process.argv.includes('--release');
const entries = ['./examples/src/example'];
if (DEBUG) {
entries.unshift('react-hot-loader/patch');
entries.unshift('webpack-dev-server/client?http://localhost:3000');
entries.unshift('webpack/hot/only-dev-server');
}
var config = {
devtool: 'eval',
entry: entries,
output: {
path: path.join(__dirname, 'dist/examples'),
filename: '[name].js',
},
resolve: {
extensions: ['', '.js', '.jsx'],
},
plugins: [
new HtmlWebpackPlugin({template: 'examples/src/index.html'}),
new ExtractTextPlugin("[name].css")
],
module: {
loaders: [
{test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader")},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /(node_modules)/
}]
}
};
if (DEBUG) {
config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
}
module.exports = config;