-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.debug-test.browser.config.js
55 lines (50 loc) · 1.86 KB
/
webpack.debug-test.browser.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
52
53
54
55
// help: http://webpack.github.io/docs/configuration.html
// help: https://webpack.github.io/docs/webpack-dev-server.html#webpack-dev-server-cli
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const rules = require('./webpack.loaders');
const plugins = require('./webpack.plugins');
const serverPort = Number(process.argv[process.argv.length - 1]);
console.log('To debug open address: http://localhost:' + serverPort + ' on any browser');
console.log('');
const config = {
mode: "development",
target: 'web', // help: https://webpack.github.io/docs/configuration.html#target
entry: [
'webpack-dev-server/client?http://localhost:'+serverPort, // bundle the client for webpack-dev-server and connect to the provided endpoint
'webpack/hot/only-dev-server', // bundle the client for hot reloading, only- means to only hot reload for successful updates
path.resolve(__dirname, 'tests/index.ts')
],
optimization: {
usedExports: true, // true to remove the dead code, for more https://webpack.js.org/guides/tree-shaking/
},
devtool: "source-map", // help: https://webpack.js.org/configuration/devtool/
devServer: {
hot: true,
port: serverPort,
},
externals: [],
output: {
path: path.resolve(__dirname, 'debug-ground/debug-test-on-browser'),
filename: 'debug-test-browser.js'
},
resolve: {
alias: {},
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js", ".jsx"]
},
module: {
rules,
},
node: {
// universal app? place here your conditional imports for node env
fs: "empty",
path: "empty",
child_process: "empty",
},
plugins: [
new webpack.HotModuleReplacementPlugin(), // enable HMR globally
new webpack.NamedModulesPlugin(), // prints more readable module names in the browser console on HMR updates
].concat(plugins),
};
module.exports = config;