-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
48 lines (44 loc) · 1.32 KB
/
webpack.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
const path = require('path');
const { merge } = require('webpack-merge');
const commonConfiguration = require('./webpack.config.js');
const ip = require('ip');
const infoColor = (message) =>
`\u001b[1m\u001b[34m${message}\u001b[39m\u001b[22m`;
module.exports = merge(commonConfiguration, {
stats: 'errors-warnings',
mode: 'development',
infrastructureLogging: {
level: 'warn',
},
devServer: {
host: 'localhost',
port: 3000,
open: true,
allowedHosts: 'all',
hot: true,
watchFiles: ['src/**'],
static: {
watch: true,
directory: path.join(__dirname, '/build'),
},
client: {
logging: 'none',
overlay: false,
progress: false,
},
historyApiFallback: true,
server: {
type: 'http',
},
setupMiddlewares: (middlewares, devServer) => {
const port = devServer.options.port;
const localIp = ip.address();
const domain1 = `http://${localIp}:${port}`;
const domain2 = `http://localhost:${port}`;
console.log(
`Проект запущен на:\n - ${infoColor(domain1)}\n - ${infoColor(domain2)}`
);
return middlewares;
},
},
});