-
Notifications
You must be signed in to change notification settings - Fork 1
/
badness.js
74 lines (70 loc) · 2.43 KB
/
badness.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
65
66
67
68
69
70
71
72
73
74
const path = require('path');
const webpack = require('webpack');
const config = {
devServer: {
contentBase: __dirname,
publicPath: '/public/dist/',
port: 8081,
historyApiFallback: true,
hot: true,
disableHostCheck: true,
},
mode: 'development', // "production" | "development" | "none" // Chosen mode tells webpack to use its built-in optimizations accordingly.
context: __dirname,
entry: [
'react-hot-loader/patch',
'webpack-dev-server/client?http://localhost:8081',
'webpack/hot/only-dev-server',
path.resolve(__dirname, './client/Index.jsx'),
],
// string | object | array // defaults to './src'
// Here the application starts executing
// and webpack starts bundling
output: {
// options related to how webpack emits results
path: path.resolve(__dirname, 'public/dist/'), // string
// the target directory for all output files
// must be an absolute path (use the Node.js path module)
filename: 'bundle.js', // string // the filename template for entry chunks
// publicPath: './client/dist', // string // the url to the output directory
// resolved relative to the HTML page
},
module: {
// configuration regarding modules
rules: [
// rules for modules (configure loaders, parser options, etc.)
{
test: /\.jsx?$/,
use: 'babel-loader',
exclude: /node_modules/,
// the loader which should be applied, it'll be resolved relative to the context
// -loader suffix is no longer optional in webpack2 for clarity reasons
// see webpack 1 upgrade guide
// options: {
// presets: ['@babel/preset-env', '@babel/preset-react'],
// },
// options for the loader
},
],
},
resolve: {
extensions: [
'.js', '.jsx', '.json',
],
},
devtool: 'inline-source-map', // enum // enhance debugging by adding meta info
// for the browser devtools
// source-map most detailed at the expense of build speed.
// the entry and module.rules.loader option
// is resolved relative to this directory
plugins: [
new webpack.HotModuleReplacementPlugin(),
],
optimization: {
namedModules: true,
},
// Tells webpack to use readable module identifiers for better debugging.
// When optimization.namedModules is not set in webpack config, webpack will
// enable it by default for mode development and disable for mode production.
};
module.exports = config;