UNPKG

3.08 kBJavaScriptView Raw
1// @remove-on-eject-begin
2/**
3 * Copyright (c) 2015-present, Facebook, Inc.
4 * All rights reserved.
5 *
6 * This source code is licensed under the BSD-style license found in the
7 * LICENSE file in the root directory of this source tree. An additional grant
8 * of patent rights can be found in the PATENTS file in the same directory.
9 */
10// @remove-on-eject-end
11'use strict';
12
13const config = require('./webpack.config.dev');
14const paths = require('./paths');
15
16const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
17const host = process.env.HOST || 'localhost';
18
19module.exports = {
20 // Enable gzip compression of generated files.
21 compress: true,
22 // Silence WebpackDevServer's own logs since they're generally not useful.
23 // It will still show compile warnings and errors with this setting.
24 clientLogLevel: 'none',
25 // By default WebpackDevServer serves physical files from current directory
26 // in addition to all the virtual build products that it serves from memory.
27 // This is confusing because those files won’t automatically be available in
28 // production build folder unless we copy them. However, copying the whole
29 // project directory is dangerous because we may expose sensitive files.
30 // Instead, we establish a convention that only files in `public` directory
31 // get served. Our build script will copy `public` into the `build` folder.
32 // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
33 // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
34 // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
35 // Note that we only recommend to use `public` folder as an escape hatch
36 // for files like `favicon.ico`, `manifest.json`, and libraries that are
37 // for some reason broken when imported through Webpack. If you just want to
38 // use an image, put it in `src` and `import` it from JavaScript instead.
39 contentBase: paths.appPublic,
40 // By default files from `contentBase` will not trigger a page reload.
41 watchContentBase: true,
42 // Enable hot reloading server. It will provide /sockjs-node/ endpoint
43 // for the WebpackDevServer client so it can learn when the files were
44 // updated. The WebpackDevServer client is included as an entry point
45 // in the Webpack development configuration. Note that only changes
46 // to CSS are currently hot reloaded. JS changes will refresh the browser.
47 hot: true,
48 // It is important to tell WebpackDevServer to use the same "root" path
49 // as we specified in the config. In development, we always serve from /.
50 publicPath: config.output.publicPath,
51 // WebpackDevServer is noisy by default so we emit custom message instead
52 // by listening to the compiler events with `compiler.plugin` calls above.
53 quiet: true,
54 // Reportedly, this avoids CPU overload on some systems.
55 // https://github.com/facebookincubator/create-react-app/issues/293
56 watchOptions: {
57 ignored: /node_modules/,
58 },
59 // Enable HTTPS if the HTTPS environment variable is set to 'true'
60 https: protocol === 'https',
61 host: host,
62 overlay: false,
63};