-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
executable file
·98 lines (97 loc) · 2.31 KB
/
webpack.config.dev.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const path = require('path');
const webpack = require('webpack');
const dotenv = require('dotenv')
const args = process.argv.slice(2);
let https = false;
let disableCORP = true;
if (args.includes('--https')) https = true;
if (args.includes('--corp')) disableCORP = false;
console.log('https', https);
console.log('disableCORP', disableCORP);
module.exports = {
devtool: 'eval',
entry: {
index: ['./js/index.js'],
meeting: ['./js/meeting.js']
},
output: {
path: path.resolve(__dirname, '/static'),
publicPath: '/static',
hashDigestLength: 5,
// filename: `zoom-meeting-${buildVersion}-[name]-[chunkhash].min.js`,
filename: '[name].min.js'
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.(jpg|png|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 500000
}
}
]
}
]
},
resolve: {
extensions: ['.js', '.jsx'],
fallback: { "os": false }
},
externals: {
'babel-polyfill': 'babel-polyfill',
react: 'React',
'react-dom': 'ReactDOM',
redux: 'Redux',
'redux-thunk': 'ReduxThunk',
lodash: {
commonjs: 'lodash',
amd: 'lodash',
root: '_',
var: '_'
}
},
context: __dirname,
target: 'web',
devServer: {
https,
cert: './localhost.crt',
key: './localhost.key',
host: '0.0.0.0',
port: 9999,
hot: true,
overlay: true,
historyApiFallback: false,
watchContentBase: true,
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': https
? 'https://0.0.0.0:9999'
: 'http://0.0.0.0:9999'
},
// open: 'chrome',
// openPage: https ? 'https://127.0.0.1:9999' : 'http://127.0.0.1:9999'
},
mode: 'development',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.BABEL_ENV': JSON.stringify('development'),
}),
new webpack.DefinePlugin({
'process.env': JSON.stringify(dotenv.config().parsed) // it will automatically pick up key values from .env file
})
]
}