Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Create React App is deprecated.Read more here.

Advanced Configuration

You can adjust various development and production settings by setting environment variables in your shell or with.env.

Note: You do not need to declareREACT_APP_ before the below variables as you would with custom environment variables.

VariableDevelopmentProductionUsage
BROWSER✅ Used🚫 IgnoredBy default, Create React App will open the default system browser, favoring Chrome on macOS. Specify abrowser to override this behavior, or set it tonone to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed tonpm start will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the.js extension.
BROWSER_ARGS✅ Used🚫 IgnoredWhen theBROWSER environment variable is specified, any arguments that you set to this environment variable will be passed to the browser instance. Multiple arguments are supported as a space separated list. By default, no arguments are passed through to browsers.
HOST✅ Used🚫 IgnoredBy default, the development web server binds to all hostnames on the device (localhost, LAN network address, etc.). You may use this variable to specify a different host.
PORT✅ Used🚫 IgnoredBy default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port.
HTTPS✅ Used🚫 IgnoredWhen set totrue, Create React App will run the development server inhttps mode.
WDS_SOCKET_HOST✅ Used🚫 IgnoredWhen set, Create React App will run the development server with a custom websocket hostname for hot module reloading. Normally,webpack-dev-server defaults towindow.location.hostname for the SockJS hostname. You may use this variable to start local development on more than one Create React App project at a time. Seewebpack-dev-server documentation for more details.
WDS_SOCKET_PATH✅ Used🚫 IgnoredWhen set, Create React App will run the development server with a custom websocket path for hot module reloading. Normally,webpack-dev-server defaults to/ws for the SockJS pathname. You may use this variable to start local development on more than one Create React App project at a time. Seewebpack-dev-server documentation for more details.
WDS_SOCKET_PORT✅ Used🚫 IgnoredWhen set, Create React App will run the development server with a custom websocket port for hot module reloading. Normally,webpack-dev-server defaults towindow.location.port for the SockJS port. You may use this variable to start local development on more than one Create React App project at a time. Seewebpack-dev-server documentation for more details.
PUBLIC_URL✅ Used✅ UsedCreate React App assumes your application is hosted at the serving web server's root or a subpath as specified inpackage.json (homepage). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application.
BUILD_PATH🚫 Ignored✅ UsedBy default, Create React App will output compiled assets to a/build directory adjacent to your/src. You may use this variable to specify a new path for Create React App to output assets. BUILD_PATH should be specified as a path relative to the root of your project.
CI✅ Used✅ UsedWhen set totrue, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default.
REACT_EDITOR✅ Used🚫 IgnoredWhen an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You cansend a pull request to detect your editor of choice. Setting this environment variable overrides the automatic detection. If you do it, make sure your systemsPATH environment variable points to your editor’s bin folder. You can also set it tonone to disable it completely.
CHOKIDAR_USEPOLLING✅ Used🚫 IgnoredWhen set totrue, the watcher runs in polling mode, as necessary inside a VM. Use this option ifnpm start isn't detecting changes.
GENERATE_SOURCEMAP🚫 Ignored✅ UsedWhen set tofalse, source maps are not generated for a production build. This solves out of memory (OOM) issues on some smaller machines.
INLINE_RUNTIME_CHUNK🚫 Ignored✅ UsedBy default, Create React App will embed the runtime script intoindex.html during the production build. When set tofalse, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP.
IMAGE_INLINE_SIZE_LIMIT✅ Used✅ UsedBy default, images smaller than 10,000 bytes are encoded as a data URI in base64 and inlined in the CSS or JS build artifact. Set this to control the size limit in bytes. Setting it to0 will disable the inlining of images.
FAST_REFRESH✅ Used🚫 IgnoredWhen set tofalse, disables experimental support for Fast Refresh to allow you to tweak your components in real time without reloading the page.
TSC_COMPILE_ON_ERROR✅ Used✅ UsedWhen set totrue, you can run and properly build TypeScript projects even if there are TypeScript type check errors. These errors are printed as warnings in the terminal and/or browser console.
ESLINT_NO_DEV_ERRORS✅ Used🚫 IgnoredWhen set totrue, ESLint errors are converted to warnings during development. As a result, ESLint output will no longer appear in the error overlay.
DISABLE_ESLINT_PLUGIN✅ Used✅ UsedWhen set totrue,eslint-webpack-plugin will be completely disabled.
DISABLE_NEW_JSX_TRANSFORM✅ Used✅ UsedWhen set totrue, disables thenew JSX transform introduced in React 17 and backported to React 16.14.0, 15.7.0, and 0.14.10. New projects will use a version of React that supports this by default but you may need to disable it in existing projects if you can't upgrade React.

[8]ページ先頭

©2009-2025 Movatter.jp