-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.demos.config.js
74 lines (71 loc) · 1.68 KB
/
webpack.demos.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
69
70
71
72
73
74
const webpack = require('webpack');
const path = require('path');
const config = {
NODE_ENV: process.env,
};
const PRODUCTION = config.NODE_ENV === 'production';
const DEVELOPMENT = config.NODE_ENV === 'development';
module.exports = {
devtool: DEVELOPMENT ? 'inline-source-map' : false,
entry: {
demo0: [
DEVELOPMENT && 'webpack-dev-server/client?http://localhost:8080',
DEVELOPMENT && 'webpack/hot/only-dev-server',
DEVELOPMENT && 'react-hot-loader/patch',
'babel-polyfill',
'./demos/demo0/index.jsx',
].filter(v => !!v),
},
output: {
filename: '[name]/bundle.js',
publicPath: '/',
path: path.resolve(__dirname, 'demos')
},
resolve: {
modules: [
path.resolve('./src'),
path.resolve('./src/components'),
'node_modules',
],
extensions: ['.json', '.js', '.jsx']
},
module: {
rules: [
{
enforce: 'pre',
test: /\.jsx?$/,
use: PRODUCTION ? 'eslint-loader' : 'eslint-loader?{emitWarning: true}',
exclude: /node_modules/,
},
{
test: /\.jsx?$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
loader: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
],
include: /node_modules/,
},
{
test: /\.styl$/,
loader: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'stylus-loader' },
],
},
{
test: /\.json$/,
loader: 'json-loader',
},
{
test: /\.(eot|otf|woff2?|ttf|svg|png)[\?]?.*$/,
loader: 'file-loader',
},
],
},
};