-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
45 lines (45 loc) · 1.29 KB
/
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
const webpack = require('webpack');
const path = require('path');
const buildPath = path.resolve(__dirname, './web/build');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const config = {
// Entry points to the project
entry: {
"host/app": path.join(__dirname, './web/src/host/app.jsx'),
"monitor/monitor": path.join(__dirname, './web/src/monitor/monitor.jsx')
},
resolve: {
extensions: ['', '.js', '.jsx']
},
watch: true,
devtool: 'sourcemap',
output: {
path: path.resolve(buildPath, "app"), // Path of output file
filename: '[name].js',
},
plugins: [
// Enables Hot Modules Replacement
new webpack.HotModuleReplacementPlugin(),
// Allows error warnings but does not stop compiling.
new webpack.NoErrorsPlugin()
],
module: {
loaders: [{
test: /(\.css)$/,
loaders: ['style-loader', 'css-loader']
},{
test: /(\.less)$/,
loaders: ['style-loader', 'css-loader', 'less-loader']
},{
// React-hot loader and
test: /(\.jsx|\.js)$/, // All .js files
loaders: ['react-hot-loader/webpack', 'babel-loader'], // react-hot is like browser sync and babel loads jsx and es6-7
exclude: [nodeModulesPath],
},{
test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]'
}
]
},
};
module.exports = config;