123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- 'use strict';
- const fs = require('fs');
- const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
- const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
- const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
- const ignoredFiles = require('react-dev-utils/ignoredFiles');
- const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
- const paths = require('./paths');
- const getHttpsConfig = require('./getHttpsConfig');
- const host = process.env.HOST || '0.0.0.0';
- const sockHost = process.env.WDS_SOCKET_HOST;
- const sockPath = process.env.WDS_SOCKET_PATH;
- const sockPort = process.env.WDS_SOCKET_PORT;
- module.exports = function (proxy, allowedHost) {
- return {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- disableHostCheck:
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
-
- compress: true,
-
-
- clientLogLevel: 'none',
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- contentBase: paths.appPublic,
- contentBasePublicPath: paths.publicUrlOrPath,
-
- watchContentBase: true,
-
-
-
-
-
- hot: true,
-
-
- transportMode: 'ws',
-
-
- injectClient: false,
-
-
-
- sockHost,
- sockPath,
- sockPort,
-
-
-
-
- publicPath: paths.publicUrlOrPath.slice(0, -1),
-
-
- quiet: true,
-
-
-
-
- watchOptions: {
- ignored: ignoredFiles(paths.appSrc),
- },
- https: getHttpsConfig(),
- host,
- overlay: false,
- historyApiFallback: {
-
-
- disableDotRule: true,
- index: paths.publicUrlOrPath,
- },
- public: allowedHost,
-
- proxy,
- before(app, server) {
-
-
-
- app.use(evalSourceMapMiddleware(server));
-
- app.use(errorOverlayMiddleware());
- if (fs.existsSync(paths.proxySetup)) {
-
- require(paths.proxySetup)(app);
- }
- },
- after(app) {
-
- app.use(redirectServedPath(paths.publicUrlOrPath));
-
-
-
-
-
- app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
- },
- };
- };
|