This repository was archived by the owner on Jul 31, 2025. It is now read-only.
forked from insin/react-heatpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
57 lines (53 loc) · 1.71 KB
/
webpack.config.js
File metadata and controls
57 lines (53 loc) · 1.71 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
'use strict'
var path = require('path')
var webpack = require('webpack')
var HEATPACK_MODULES = path.join(__dirname, 'node_modules')
var NODE_MODULES_RE = /node_modules/
var DUMMY_ENTRY_RE = /react-heatpack[\\/]dummy.js$/
// We need to special-case loading the heatpack dummy entry module as it will
// be under global node_modules.
function excludeJS(absPath) {
if (DUMMY_ENTRY_RE.test(absPath)) {
return false
}
return NODE_MODULES_RE.test(absPath)
}
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server'
// App entry point to be provided as an argument to heatpack
],
output: {
path: __dirname + '/build',
filename: 'bundle.js',
publicPath: '/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
resolve: {
extensions: ['', '.js', '.jsx', '.cjsx', '.coffee'],
// Fall back to find heatpack's dependencies for wepack entry modules above
fallback: HEATPACK_MODULES
},
resolveLoader: {
// Resolve loaders from heatpack's dependencies
modulesDirectories: [HEATPACK_MODULES],
},
module: {
loaders: [
{test: /\.jsx?$/, loader: 'react-hot!babel?stage=0', exclude: excludeJS},
{test: /\.cjsx$/, loader: 'react-hot!coffee!cjsx', exclude: NODE_MODULES_RE},
{test: /\.coffee$/, loader: 'coffee', exclude: NODE_MODULES_RE},
{test: /\.json$/, loader: 'json'},
{test: /\.css$/, loader: 'style!css?-restructuring!autoprefixer'},
{test: /\.(gif|jpe?g|png|otf|eot|svg|ttf|woff|woff2).*$/, loader: 'url?limit=8192'}
]
}
}