UNPKG

951 BJavaScriptView Raw
1const path = require('path');
2const webpack = require('webpack');
3
4const isDevServer = process.argv.find(v => v.indexOf('webpack-dev-server') !== -1);
5
6module.exports = {
7 entry: !isDevServer ? ['./demos/non-hot-reload'] : [
8 'react-hot-loader/patch',
9 'webpack-dev-server/client?http://localhost:8080',
10 'webpack/hot/only-dev-server',
11 './demos/hot-reload'
12 ],
13 output: {
14 filename: 'bundle.js'
15 },
16 devtool: 'source-map',
17 module: {
18 loaders: [
19 {
20 test: /\.jsx?$/,
21 exclude: /node_modules/,
22 loader: 'babel-loader',
23 query: {
24 presets: ['es2015', 'react']
25 }
26 },
27 {
28 test: /\.scss$/,
29 loaders: [
30 'style',
31 'css',
32 'sass?' + JSON.stringify({
33 includePaths: [path.resolve(__dirname, './bower_components')]
34 })
35 ]
36 },
37 {
38 test: /\.html/,
39 loader: 'raw'
40 }
41 ]
42 },
43 plugins: isDevServer ? [] : [
44 new webpack.DefinePlugin({
45 'process.env.NODE_ENV': '"production"'
46 })
47 ]
48};