-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
51 lines (40 loc) · 1.19 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
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const DEV = 'development'
const MODE = process.env.NODE_ENV ? process.env.NODE_ENV : DEV
const ENDS_WITH_JS = /\.jsx?$/
const ENDS_WITH_CSS = /\.css$/i
const NODE_MODULES_DIR = /node_modules/
const devServer = {
contentBase: path.resolve(__dirname, 'utilities_for_me/web_app/static'),
hot: true
}
module.exports = {
entry: './utilities_for_me/web_app/client/react/index.jsx',
resolve: {
extensions: ['.js', '.jsx']
},
output: {
path: path.resolve(__dirname, 'utilities_for_me/web_app/static'),
filename: 'index-bundle.js'
},
mode: MODE,
module: {
rules: [
{
test: ENDS_WITH_JS,
exclude: NODE_MODULES_DIR,
use: {
loader: 'babel-loader' // Magically finds this module and magically gets a babelrc (ugh!)
}
},
{
test: ENDS_WITH_CSS,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader'] // Magically finds loaders and libs?, transformed from right to left?
}
]
},
plugins: [new MiniCssExtractPlugin({ filename: 'index-bundle.css' })],
devServer: devServer,
devtool: 'source-map'
}