-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.cjs
53 lines (50 loc) · 1.11 KB
/
webpack.config.cjs
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
'use strict'
/**
* webpack configuration for zedide frontend
*
* rob andrews <[email protected]>
*/
const webpack = require('webpack')
const path = require('path')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
devtool: process.env.NODE_ENV === 'production' ? false : 'inline-source-map',
optimization: {
minimize: process.env.NODE_ENV === 'production' ? true : false,
minimizer: [
new TerserPlugin({
test: /\.js(\?.*)?$/i
})
]
},
entry: {
frontend: './src/frontend/index.js'
},
output: {
path: path.resolve(__dirname, 'public/js/'),
filename: '[name].bundle.js',
},
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.js$/i,
use: ['babel-loader']
}
]
},
devServer: {
contentBase: path.resolve(__dirname, 'public/'),
publicPath: '/js/',
compress: true,
host: '0.0.0.0',
port: 4000,
proxy: {
'/api': 'http://localhost:3000'
}
}
}