forked from subschema/subschema
-
Notifications
You must be signed in to change notification settings - Fork 4
/
hot.webpack.config.js
124 lines (113 loc) · 3.97 KB
/
hot.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
require('es6-promise').polyfill();
var path = require('path');
var join = path.join.bind(path, __dirname);
//var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require('webpack');
var AUTOPREFIXER_LOADER = 'autoprefixer-loader?{browsers:[' +
'"Android 2.3", "Android >= 4", "Chrome >= 20", "Firefox >= 24", ' +
'"Explorer >= 8", "iOS >= 6", "Opera >= 12", "Safari >= 6"]}';
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:' + 8084,
'webpack/hot/only-dev-server',
join('public/app.jsx')
],
devServer: {
contentBase: join("public"),
info: true, // --no-info option
hot: true,
inline: true,
port: 8084
},
output: {
path: join(".hot"),
filename: 'app.js',
chunkFilename: '[id].chunk.js',
publicPath: '/'
},
stats: {
colors: true,
reasons: true
},
module: {
loaders: [
{
test: /\.js(x)?$/,
exclude: /node_modules/,
//do this to prevent babel from translating everything.
include: [
join('src'),
join('public')
],
loaders: ['react-hot', 'babel-loader?stage=0&ignore=buffer']
},
{
test: /\.js(x)?$/,
exclude: [
// /node_modules\/(?!(subschema-builder|component-playground|react-))/,
/babel/,
/react-router/,
/codemirror/,
join('src'),
join('public'),
],
loaders: ['babel?stage=0&ignore=buffer']
},
{test: /\.(png|jpe?g|mpe?g|gif)$/, loader: 'url-loader?limit=100000'},
{test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff"},
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/octet-stream"},
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"},
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=image/svg+xml"},
// Optionally extract less files
// or any other compile-to-css language
{
test: /\.css$/,
// loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader')
loader: 'style-loader!css-loader'
},
{
test: /\.less$/,
loaders: ['style', 'css', 'less']
},
{
test: /\.json$/,
loader: 'json'
}
]
},
postcss: [
require('autoprefixer'),
require('postcss-color-rebeccapurple')
],
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
'subschema': join('src/index.jsx'),
'Subschema': join('src/index.jsx'),
'react': join('node_modules/react'),
'subschema-styles': join('src/styles'),
'react-router': join('node_modules/react-router/umd/ReactRouter')
}
},
plugins: [
new webpack.ProvidePlugin({
CodeMirror: "codemirror",
"window.CodeMirror": "codemirror"
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
// new ExtractTextPlugin('style.css', {allChunks: true}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
function () {
this.plugin("done", function (stats) {
stats = stats.toJson();
console.error(JSON.stringify({
assetsByChunkName: stats.assetsByChunkName
}));
});
}
]
};