Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
- const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
- const path = require('path');
- const config = require('./webpack.config.dev');
- const paths = require('./paths');
- const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
- const host = process.env.HOST || '0.0.0.0';
- module.exports = function(proxy, allowedHost) {
- return {
- disableHostCheck:
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
- compress: true,
- clientLogLevel: 'none',
- contentBase: paths.appPublic,
- watchContentBase: true,
- hot: true,
- publicPath: config.output.publicPath,
- quiet: true,
- watchOptions: {
- ignored: new RegExp(
- `^(?!${path
- .normalize(paths.appSrc + '/')
- .replace(/[\\]+/g, '\\\\')}).+[\\\\/]node_modules[\\\\/]`,
- 'g'
- ),
- },
- // Enable HTTPS if the HTTPS environment variable is set to 'true'
- https: protocol === 'https',
- host: host,
- overlay: false,
- historyApiFallback: {
- // Paths with dots should still use the history fallback.
- // See https://github.com/facebookincubator/create-react-app/issues/387.
- disableDotRule: true,
- },
- public: allowedHost,
- proxy,
- before(app) {
- // This lets us open files from the runtime error overlay.
- app.use(errorOverlayMiddleware());
- // This service worker file is effectively a 'no-op' that will reset any
- // previous service worker registered for the same host:port combination.
- // We do this in development to avoid hitting the production cache if
- // it used the same host and port.
- // https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
- app.use(noopServiceWorkerMiddleware());
- },
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement