-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
47 lines (45 loc) · 1.23 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
const webpack = require('webpack');
const path = require('path');
const buildPath = path.resolve(__dirname, 'static/build');
const nodeModulesPath = path.resolve(__dirname, 'node_modules');
const config = {
// Entry points to the project
entry: {
app: path.join(__dirname, '/static/app/app.js'),
admin: path.join(__dirname, '/static/admin/admin.js')
},
output: {
path: buildPath, // Path of output file
filename: '[name].bundle.js',
publicPath: '/dev-bundle/',
},
module: {
rules: [
{
// React-hot loader and
test: /\.js$/, // All .js files
exclude: [nodeModulesPath],
use: {
loader: 'babel-loader', // react-hot is like browser sync and babel loads jsx and es6-7
options: {
presets: [
'@babel/preset-env',
'@babel/preset-react',
],
plugins: [
'@babel/proposal-object-rest-spread',
'@babel/plugin-syntax-dynamic-import',
'@babel/proposal-class-properties',
]
}
}
},
{
test: /\.css$/,
loaders: ['style', 'css'],
exclude: [nodeModulesPath],
}
],
},
};
module.exports = config;