-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
64 lines (55 loc) · 1.68 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var webpack = require('webpack');
var path = require('path');
var node_dir = __dirname + '/node_modules',
lib_dir = __dirname + '/public/libraries';
var config = {
// The resolve.alias object takes require expressions
// (require('react')) as keys and filepath to actual
// module as values
resolve: {
alias: {
react: lib_dir + '/react',
"react-dom": lib_dir + '/react-dom',
"jquery": lib_dir + '/jquery-3.2.1.js'
}
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({ //
name: 'vendors',
filename: 'build/vendors.bundle.js',
minChunks: 2,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
entry: {
musicApp: ['./public/js/music-app.js', 'webpack/hot/only-dev-server'],
vendors: ['react', 'react-dom', 'jquery', 'webpack/hot/only-dev-server']
},
output: {
path: path.join(__dirname, "public"),
filename: 'build/[name].bundle.js',
libraryTarget: "umd"
},
module: {
noParse: [
new RegExp(lib_dir + './react.js'),
new RegExp(lib_dir + './react-dom.js')
],
rules: [
{
test: /\.js?$/,
loaders: ['react-hot-loader/webpack', 'babel-loader'],
include: path.join(__dirname, 'public')
},
{
loader: 'babel-loader',
query: {
presets: ['react', 'es2015']
},
include: path.join(__dirname, 'public')
}
]
}
}
module.exports = config;