-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
43 lines (42 loc) · 1.14 KB
/
webpack.config.js
File metadata and controls
43 lines (42 loc) · 1.14 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
var path = require('path')
var webpack = require('webpack')
module.exports = function(component_to_render, sourcePath) {
return {
devtool: 'eval',
entry: [
'./node_modules/react-hot-loader/patch',
'./node_modules/webpack-dev-server/client?http://localhost:3000', // TODO: read port from package settings
'./node_modules/webpack/hot/only-dev-server',
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
__COMPONENT_TO_RENDER: JSON.stringify(component_to_render)
}),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['react-hot-loader/webpack', 'babel-loader'],
include: [
path.join(__dirname, 'src'),
path.resolve(sourcePath)
],
exclude: /node_modules/
},
{ test: /\.less$/, loader: 'style!css!less' },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.(png|jpg|jpeg|gif|woff)$/, loader: 'file-loader' }
]
}
}
}