-
Notifications
You must be signed in to change notification settings - Fork 15
/
webpack.config.js
42 lines (39 loc) · 1.25 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
'use strict';
const webpack = require('webpack');
const path = require('path');
const BUILD_DIR = path.resolve(__dirname, 'public/js/build');
const APP_DIR = path.resolve(__dirname, 'public/js');
const config = {
context: APP_DIR,
entry: {
app: './main.js'
},
output: {
path: BUILD_DIR,
filename: 'bundle.js',
publicPath: "/"
},
module: {
rules: [
{
test: /\.(js|jsx)$/, //Check for all js files
exclude: /node_modules/,
loader: 'babel-loader',
options: {
babelrc: false,
presets: ['@babel/preset-env', '@babel/preset-react'],
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
plugins: [ '@babel/plugin-proposal-function-bind', '@babel/plugin-proposal-class-properties'],
},
}
]
},
devServer: {
contentBase: __dirname + '/public/js'
},
devtool: "eval-source-map"
};
module.exports = config;