From 91516476330fa8ae4da6616034c954d86d002afe Mon Sep 17 00:00:00 2001 From: Eric Feng Date: Tue, 23 Oct 2018 22:33:00 -0700 Subject: [PATCH 1/2] Fixing Internal Links Internal links, like those found on [Available Scripts](https://facebook.github.io/create-react-app/docs/available-scripts) use absolute urls and therefore link to https://facebook.github.io/docs/deployment instead of https://facebook.github.io/create-react-app/docs/deployment. --- docusaurus/docs/adding-a-css-modules-stylesheet.md | 2 +- docusaurus/docs/adding-a-router.md | 2 +- docusaurus/docs/adding-a-sass-stylesheet.md | 2 +- docusaurus/docs/adding-custom-environment-variables.md | 5 +++-- docusaurus/docs/advanced-configuration.md | 4 ++-- docusaurus/docs/alternatives-to-ejecting.md | 2 +- docusaurus/docs/available-scripts.md | 4 ++-- docusaurus/docs/deployment.md | 4 ++-- docusaurus/docs/making-a-progressive-web-app.md | 6 +++--- docusaurus/docs/proxying-api-requests-in-development.md | 2 +- docusaurus/docs/setting-up-your-editor.md | 4 ++-- docusaurus/docs/title-and-meta-tags.md | 4 ++-- docusaurus/docs/troubleshooting.md | 2 +- docusaurus/docs/using-https-in-development.md | 2 +- docusaurus/docs/using-the-public-folder.md | 6 +++--- 15 files changed, 26 insertions(+), 25 deletions(-) diff --git a/docusaurus/docs/adding-a-css-modules-stylesheet.md b/docusaurus/docs/adding-a-css-modules-stylesheet.md index 4dfdce32ef5..c3e90006f27 100644 --- a/docusaurus/docs/adding-a-css-modules-stylesheet.md +++ b/docusaurus/docs/adding-a-css-modules-stylesheet.md @@ -8,7 +8,7 @@ sidebar_label: Adding CSS Modules This project supports [CSS Modules](https://github.com/css-modules/css-modules) alongside regular stylesheets using the `[name].module.css` file naming convention. CSS Modules allows the scoping of CSS by automatically creating a unique classname of the format `[filename]\_[classname]\_\_[hash]`. -> **Tip:** Should you want to preprocess a stylesheet with Sass then make sure to [follow the installation instructions](/docs/adding-a-sass-stylesheet) and then change the stylesheet file extension as follows: `[name].module.scss` or `[name].module.sass`. +> **Tip:** Should you want to preprocess a stylesheet with Sass then make sure to [follow the installation instructions](docs/adding-a-sass-stylesheet) and then change the stylesheet file extension as follows: `[name].module.scss` or `[name].module.sass`. CSS Modules let you use the same CSS class name in different files without worrying about naming clashes. Learn more about CSS Modules [here](https://css-tricks.com/css-modules-part-1-need/). diff --git a/docusaurus/docs/adding-a-router.md b/docusaurus/docs/adding-a-router.md index 70dfcb63b6e..9c9b0ea036f 100644 --- a/docusaurus/docs/adding-a-router.md +++ b/docusaurus/docs/adding-a-router.md @@ -19,4 +19,4 @@ yarn add react-router-dom To try it, delete all the code in `src/App.js` and replace it with any of the examples on its website. The [Basic Example](https://reacttraining.com/react-router/web/example/basic) is a good place to get started. -Note that [you may need to configure your production server to support client-side routing](/docs/deployments#serving-apps-with-client-side-routing) before deploying your app. +Note that [you may need to configure your production server to support client-side routing](docs/deployments#serving-apps-with-client-side-routing) before deploying your app. diff --git a/docusaurus/docs/adding-a-sass-stylesheet.md b/docusaurus/docs/adding-a-sass-stylesheet.md index ad3815b1ab3..cf0108d7aae 100644 --- a/docusaurus/docs/adding-a-sass-stylesheet.md +++ b/docusaurus/docs/adding-a-sass-stylesheet.md @@ -30,7 +30,7 @@ This will allow you to do imports like @import '~nprogress/nprogress'; // importing a css file from the nprogress node module ``` -> **Tip:** You can opt into using this feature with [CSS modules](/docs/adding-a-css-modules-stylesheet) too! +> **Tip:** You can opt into using this feature with [CSS modules](docs/adding-a-css-modules-stylesheet) too! > **Note:** You must prefix imports from `node_modules` with `~` as displayed above. diff --git a/docusaurus/docs/adding-custom-environment-variables.md b/docusaurus/docs/adding-custom-environment-variables.md index f9a462b7005..5dbd0f03244 100644 --- a/docusaurus/docs/adding-custom-environment-variables.md +++ b/docusaurus/docs/adding-custom-environment-variables.md @@ -3,13 +3,14 @@ id: adding-custom-environment-variables title: Adding Custom Environment Variables sidebar_label: Environment Variables --- + > Note: this feature is available with `react-scripts@0.2.3` and higher. Your project can consume variables declared in your environment as if they were declared locally in your JS files. By default you will have `NODE_ENV` defined for you, and any other environment variables starting with `REACT_APP_`. -**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](/docs/injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them. +**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](docs/injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them. > Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebook/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running. @@ -77,7 +78,7 @@ You can also access the environment variables starting with `REACT_APP_` in the Note that the caveats from the above section apply: - Apart from a few built-in variables (`NODE_ENV` and `PUBLIC_URL`), variable names must start with `REACT_APP_` to work. -- The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](/docs/generating-dynamic-meta-tags-on-the-server). +- The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](docs/generating-dynamic-meta-tags-on-the-server). ## Adding Temporary Environment Variables In Your Shell diff --git a/docusaurus/docs/advanced-configuration.md b/docusaurus/docs/advanced-configuration.md index 2150b18e15d..754b36a5e85 100644 --- a/docusaurus/docs/advanced-configuration.md +++ b/docusaurus/docs/advanced-configuration.md @@ -3,7 +3,7 @@ id: advanced-configuration title: Advanced Configuration --- -You can adjust various development and production settings by setting environment variables in your shell or with [.env](/docs/adding-development-environment-variables-in-env). +You can adjust various development and production settings by setting environment variables in your shell or with [.env](docs/adding-development-environment-variables-in-env). | Variable | Development | Production | Usage | | :------------------- | :---------: | :--------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -11,7 +11,7 @@ You can adjust various development and production settings by setting environmen | HOST | ✅ Used | 🚫 Ignored | By default, the development web server binds to `localhost`. You may use this variable to specify a different host. | | PORT | ✅ Used | 🚫 Ignored | By 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 | 🚫 Ignored | When set to `true`, Create React App will run the development server in `https` mode. | -| PUBLIC_URL | 🚫 Ignored | ✅ Used | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](/docs/deployment#building-for-relative-paths). 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. | +| PUBLIC_URL | 🚫 Ignored | ✅ Used | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](docs/deployment#building-for-relative-paths). 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. | | CI | ✅ Used | ✅ Used | When set to `true`, 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 | 🚫 Ignored | When 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 can [send a pull request to detect your editor of choice](https://github.com/facebook/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH]() environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely. | | CHOKIDAR_USEPOLLING | ✅ Used | 🚫 Ignored | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. | diff --git a/docusaurus/docs/alternatives-to-ejecting.md b/docusaurus/docs/alternatives-to-ejecting.md index 1bbc066c3bf..8e064966de9 100644 --- a/docusaurus/docs/alternatives-to-ejecting.md +++ b/docusaurus/docs/alternatives-to-ejecting.md @@ -3,4 +3,4 @@ id: alternatives-to-ejecting title: Alternatives to Ejecting --- -[Ejecting](/docs/available-scripts#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to _fork_ `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebook/create-react-app/issues/682). +[Ejecting](docs/available-scripts#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to _fork_ `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebook/create-react-app/issues/682). diff --git a/docusaurus/docs/available-scripts.md b/docusaurus/docs/available-scripts.md index b52b0926bb7..cb419d0c8eb 100644 --- a/docusaurus/docs/available-scripts.md +++ b/docusaurus/docs/available-scripts.md @@ -14,7 +14,7 @@ The page will reload if you make edits. You will also see any lint errors in the ## `npm test` -Launches the test runner in the interactive watch mode. See the section about [running tests](/docs/running-tests) for more information. +Launches the test runner in the interactive watch mode. See the section about [running tests](docs/running-tests) for more information. ## `npm run build` @@ -22,7 +22,7 @@ Builds the app for production to the `build` folder. It correctly bundles React The build is minified and the filenames include the hashes. Your app is ready to be deployed! -See the section about [deployment](/docs/deployment) for more information. +See the section about [deployment](docs/deployment) for more information. ## `npm run eject` diff --git a/docusaurus/docs/deployment.md b/docusaurus/docs/deployment.md index 6260c9953db..e915ac58675 100644 --- a/docusaurus/docs/deployment.md +++ b/docusaurus/docs/deployment.md @@ -79,11 +79,11 @@ If you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow Now requests to `/todos/42` will be handled correctly both in development and in production. -On a production build, and when you've [opted-in](/docs/making-a-progressive-web-app#why-opt-in), +On a production build, and when you've [opted-in](docs/making-a-progressive-web-app#why-opt-in), a [service worker](https://developers.google.com/web/fundamentals/primers/service-workers/) will automatically handle all navigation requests, like for `/todos/42`, by serving the cached copy of your `index.html`. This service worker navigation routing can be configured or disabled by -[`eject`ing](/docs/available-scripts#npm-run-eject) and then modifying the +[`eject`ing](docs/available-scripts#npm-run-eject) and then modifying the [`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string) and [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp) options of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js). diff --git a/docusaurus/docs/making-a-progressive-web-app.md b/docusaurus/docs/making-a-progressive-web-app.md index 23b43f551da..e796fca0530 100644 --- a/docusaurus/docs/making-a-progressive-web-app.md +++ b/docusaurus/docs/making-a-progressive-web-app.md @@ -73,7 +73,7 @@ following into account: If your production web server does not support HTTPS, then the service worker registration will fail, but the rest of your web app will remain functional. -1. The service worker is only enabled in the [production environment](/docs/deployment), +1. The service worker is only enabled in the [production environment](docs/deployment), e.g. the output of `npm run build`. It's recommended that you do not enable an offline-first service worker in a development environment, as it can lead to frustration when previously cached assets are used and do not include the latest @@ -82,12 +82,12 @@ following into account: 1. If you _need_ to test your offline-first service worker locally, build the application (using `npm run build`) and run a simple http server from your build directory. After running the build script, `create-react-app` will give - instructions for one way to test your production build locally and the [deployment instructions](/docs/deployment) have + instructions for one way to test your production build locally and the [deployment instructions](docs/deployment) have instructions for using other methods. _Be sure to always use an incognito window to avoid complications with your browser cache._ 1. By default, the generated service worker file will not intercept or cache any - cross-origin traffic, like HTTP [API requests](/docs/integrating-with-an-api-backend), + cross-origin traffic, like HTTP [API requests](docs/integrating-with-an-api-backend), images, or embeds loaded from a different domain. ## Progressive Web App Metadata diff --git a/docusaurus/docs/proxying-api-requests-in-development.md b/docusaurus/docs/proxying-api-requests-in-development.md index fe238bb1a18..1713efc5333 100644 --- a/docusaurus/docs/proxying-api-requests-in-development.md +++ b/docusaurus/docs/proxying-api-requests-in-development.md @@ -38,7 +38,7 @@ If the `proxy` option is **not** flexible enough for you, alternatively you can: - [Configure the proxy yourself](#configuring-the-proxy-manually) - Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)). -- Use [environment variables](/docs/adding-custom-environment-variables) to inject the right server host and port into your app. +- Use [environment variables](docs/adding-custom-environment-variables) to inject the right server host and port into your app. ## "Invalid Host Header" Errors After Configuring Proxy diff --git a/docusaurus/docs/setting-up-your-editor.md b/docusaurus/docs/setting-up-your-editor.md index 16f61153f3e..75141a7e935 100644 --- a/docusaurus/docs/setting-up-your-editor.md +++ b/docusaurus/docs/setting-up-your-editor.md @@ -63,7 +63,7 @@ Then add the block below to your `launch.json` file and put it inside the `.vsco } ``` -> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](/docs/advanced-configuration). +> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](docs/advanced-configuration). Start your app by running `npm start`, and start debugging in VS Code by pressing `F5` or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor. @@ -75,7 +75,7 @@ You would need to have [WebStorm](https://www.jetbrains.com/webstorm/) and [JetB In the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and select `JavaScript Debug`. Paste `http://localhost:3000` into the URL field and save the configuration. -> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](/docs/advanced-configuration). +> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](docs/advanced-configuration). Start your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm. diff --git a/docusaurus/docs/title-and-meta-tags.md b/docusaurus/docs/title-and-meta-tags.md index 43928a42ea0..8bac7e9cc23 100644 --- a/docusaurus/docs/title-and-meta-tags.md +++ b/docusaurus/docs/title-and-meta-tags.md @@ -8,11 +8,11 @@ sidebar_label: Title & Meta Tags You can find the source HTML file in the `public` folder of the generated project. You may edit the `` tag in it to change the title from “React App” to anything else. -Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](/docs/adding-a-stylesheet) is done without touching the HTML. +Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](docs/adding-a-stylesheet) is done without touching the HTML. If you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library. -If you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](/docs/generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](/docs/pre-rendering-into-static-html-files). +If you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](docs/generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](docs/pre-rendering-into-static-html-files). ## Generating Dynamic `<meta>` Tags on the Server diff --git a/docusaurus/docs/troubleshooting.md b/docusaurus/docs/troubleshooting.md index 47964b0ff7c..a022a002e8a 100644 --- a/docusaurus/docs/troubleshooting.md +++ b/docusaurus/docs/troubleshooting.md @@ -53,7 +53,7 @@ If you are completely sure that you didn't terminate the process, consider [addi ## `npm run build` fails on Heroku This may be a problem with case sensitive filenames. -Please refer to [this section](/docs/deployment#resolving-heroku-deployment-errors). +Please refer to [this section](docs/deployment#resolving-heroku-deployment-errors). ## Moment.js locales are missing diff --git a/docusaurus/docs/using-https-in-development.md b/docusaurus/docs/using-https-in-development.md index ebefce2f7a9..717c71dcb88 100644 --- a/docusaurus/docs/using-https-in-development.md +++ b/docusaurus/docs/using-https-in-development.md @@ -6,7 +6,7 @@ sidebar_label: HTTPS in Development > Note: this feature is available with `react-scripts@0.4.0` and higher. -You may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the "proxy" feature](/docs/proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS. +You may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the "proxy" feature](docs/proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS. To do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`: diff --git a/docusaurus/docs/using-the-public-folder.md b/docusaurus/docs/using-the-public-folder.md index b994b6142e7..69641904e18 100644 --- a/docusaurus/docs/using-the-public-folder.md +++ b/docusaurus/docs/using-the-public-folder.md @@ -7,7 +7,7 @@ title: Using the Public Folder ## Changing the HTML -The `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](/docs/changing-the-page-title). +The `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](docs/changing-the-page-title). The `<script>` tag with the compiled code will be added to it automatically during the build process. ## Adding Assets Outside of the Module System @@ -15,7 +15,7 @@ The `<script>` tag with the compiled code will be added to it automatically duri You can also add other assets to the `public` folder. Note that we normally encourage you to `import` assets in JavaScript files instead. -For example, see the sections on [adding a stylesheet](/docs/adding-a-stylesheet) and [adding images and fonts](/docs/adding-images-fonts-and-files). +For example, see the sections on [adding a stylesheet](docs/adding-a-stylesheet) and [adding images and fonts](docs/adding-images-fonts-and-files). This mechanism provides a number of benefits: - Scripts and stylesheets get minified and bundled together to avoid extra network requests. @@ -55,7 +55,7 @@ Keep in mind the downsides of this approach: ## When to Use the `public` Folder -Normally we recommend importing [stylesheets](/docs/adding-a-stylesheet), [images, and fonts](/docs/adding-images-fonts-and-files) from JavaScript. +Normally we recommend importing [stylesheets](docs/adding-a-stylesheet), [images, and fonts](docs/adding-images-fonts-and-files) from JavaScript. The `public` folder is useful as a workaround for a number of less common cases: - You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest). From d707b3de73f5c31616740f14cb509cf5eab71c68 Mon Sep 17 00:00:00 2001 From: Eric Feng <erichfeng@gmail.com> Date: Fri, 26 Oct 2018 00:50:36 -0700 Subject: [PATCH 2/2] changing to markdown links and fixing various broken internal links --- docusaurus/docs/adding-a-css-modules-stylesheet.md | 2 +- docusaurus/docs/adding-a-router.md | 2 +- docusaurus/docs/adding-a-sass-stylesheet.md | 2 +- docusaurus/docs/adding-custom-environment-variables.md | 4 ++-- docusaurus/docs/advanced-configuration.md | 4 ++-- docusaurus/docs/alternatives-to-ejecting.md | 2 +- docusaurus/docs/available-scripts.md | 4 ++-- docusaurus/docs/deployment.md | 4 ++-- docusaurus/docs/making-a-progressive-web-app.md | 6 +++--- docusaurus/docs/proxying-api-requests-in-development.md | 2 +- docusaurus/docs/setting-up-your-editor.md | 4 ++-- docusaurus/docs/title-and-meta-tags.md | 4 ++-- docusaurus/docs/troubleshooting.md | 2 +- docusaurus/docs/using-https-in-development.md | 2 +- docusaurus/docs/using-the-public-folder.md | 6 +++--- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docusaurus/docs/adding-a-css-modules-stylesheet.md b/docusaurus/docs/adding-a-css-modules-stylesheet.md index c3e90006f27..72b58bfe99e 100644 --- a/docusaurus/docs/adding-a-css-modules-stylesheet.md +++ b/docusaurus/docs/adding-a-css-modules-stylesheet.md @@ -8,7 +8,7 @@ sidebar_label: Adding CSS Modules This project supports [CSS Modules](https://github.com/css-modules/css-modules) alongside regular stylesheets using the `[name].module.css` file naming convention. CSS Modules allows the scoping of CSS by automatically creating a unique classname of the format `[filename]\_[classname]\_\_[hash]`. -> **Tip:** Should you want to preprocess a stylesheet with Sass then make sure to [follow the installation instructions](docs/adding-a-sass-stylesheet) and then change the stylesheet file extension as follows: `[name].module.scss` or `[name].module.sass`. +> **Tip:** Should you want to preprocess a stylesheet with Sass then make sure to [follow the installation instructions](adding-a-sass-stylesheet.md) and then change the stylesheet file extension as follows: `[name].module.scss` or `[name].module.sass`. CSS Modules let you use the same CSS class name in different files without worrying about naming clashes. Learn more about CSS Modules [here](https://css-tricks.com/css-modules-part-1-need/). diff --git a/docusaurus/docs/adding-a-router.md b/docusaurus/docs/adding-a-router.md index 9c9b0ea036f..3dda1baac86 100644 --- a/docusaurus/docs/adding-a-router.md +++ b/docusaurus/docs/adding-a-router.md @@ -19,4 +19,4 @@ yarn add react-router-dom To try it, delete all the code in `src/App.js` and replace it with any of the examples on its website. The [Basic Example](https://reacttraining.com/react-router/web/example/basic) is a good place to get started. -Note that [you may need to configure your production server to support client-side routing](docs/deployments#serving-apps-with-client-side-routing) before deploying your app. +Note that [you may need to configure your production server to support client-side routing](deployment.md#serving-apps-with-client-side-routing) before deploying your app. diff --git a/docusaurus/docs/adding-a-sass-stylesheet.md b/docusaurus/docs/adding-a-sass-stylesheet.md index cf0108d7aae..dc3f77392be 100644 --- a/docusaurus/docs/adding-a-sass-stylesheet.md +++ b/docusaurus/docs/adding-a-sass-stylesheet.md @@ -30,7 +30,7 @@ This will allow you to do imports like @import '~nprogress/nprogress'; // importing a css file from the nprogress node module ``` -> **Tip:** You can opt into using this feature with [CSS modules](docs/adding-a-css-modules-stylesheet) too! +> **Tip:** You can opt into using this feature with [CSS modules](adding-a-css-modules-stylesheet.md) too! > **Note:** You must prefix imports from `node_modules` with `~` as displayed above. diff --git a/docusaurus/docs/adding-custom-environment-variables.md b/docusaurus/docs/adding-custom-environment-variables.md index 5dbd0f03244..15d5527106b 100644 --- a/docusaurus/docs/adding-custom-environment-variables.md +++ b/docusaurus/docs/adding-custom-environment-variables.md @@ -10,7 +10,7 @@ Your project can consume variables declared in your environment as if they were default you will have `NODE_ENV` defined for you, and any other environment variables starting with `REACT_APP_`. -**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](docs/injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them. +**The environment variables are embedded during the build time**. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, just like [described here](title-and-meta-tags.md#injecting-data-from-the-server-into-the-page). Alternatively you can rebuild the app on the server anytime you change them. > Note: You must create custom environment variables beginning with `REACT_APP_`. Any other variables except `NODE_ENV` will be ignored to avoid accidentally [exposing a private key on the machine that could have the same name](https://github.com/facebook/create-react-app/issues/865#issuecomment-252199527). Changing any environment variables will require you to restart the development server if it is running. @@ -78,7 +78,7 @@ You can also access the environment variables starting with `REACT_APP_` in the Note that the caveats from the above section apply: - Apart from a few built-in variables (`NODE_ENV` and `PUBLIC_URL`), variable names must start with `REACT_APP_` to work. -- The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](docs/generating-dynamic-meta-tags-on-the-server). +- The environment variables are injected at build time. If you need to inject them at runtime, [follow this approach instead](title-and-meta-tags.md#generating-dynamic-meta-tags-on-the-server). ## Adding Temporary Environment Variables In Your Shell diff --git a/docusaurus/docs/advanced-configuration.md b/docusaurus/docs/advanced-configuration.md index 754b36a5e85..c991fd72edb 100644 --- a/docusaurus/docs/advanced-configuration.md +++ b/docusaurus/docs/advanced-configuration.md @@ -3,7 +3,7 @@ id: advanced-configuration title: Advanced Configuration --- -You can adjust various development and production settings by setting environment variables in your shell or with [.env](docs/adding-development-environment-variables-in-env). +You can adjust various development and production settings by setting environment variables in your shell or with [.env](adding-custom-environment-variables.md#adding-development-environment-variables-in-env). | Variable | Development | Production | Usage | | :------------------- | :---------: | :--------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -11,7 +11,7 @@ You can adjust various development and production settings by setting environmen | HOST | ✅ Used | 🚫 Ignored | By default, the development web server binds to `localhost`. You may use this variable to specify a different host. | | PORT | ✅ Used | 🚫 Ignored | By 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 | 🚫 Ignored | When set to `true`, Create React App will run the development server in `https` mode. | -| PUBLIC_URL | 🚫 Ignored | ✅ Used | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](docs/deployment#building-for-relative-paths). 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. | +| PUBLIC_URL | 🚫 Ignored | ✅ Used | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](deployment#building-for-relative-paths). 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.md). This may be particularly useful when using a CDN to host your application. | | CI | ✅ Used | ✅ Used | When set to `true`, 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 | 🚫 Ignored | When 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 can [send a pull request to detect your editor of choice](https://github.com/facebook/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH](<https://en.wikipedia.org/wiki/PATH_(variable)>) environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely. | | CHOKIDAR_USEPOLLING | ✅ Used | 🚫 Ignored | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. | diff --git a/docusaurus/docs/alternatives-to-ejecting.md b/docusaurus/docs/alternatives-to-ejecting.md index 8e064966de9..6686ed93408 100644 --- a/docusaurus/docs/alternatives-to-ejecting.md +++ b/docusaurus/docs/alternatives-to-ejecting.md @@ -3,4 +3,4 @@ id: alternatives-to-ejecting title: Alternatives to Ejecting --- -[Ejecting](docs/available-scripts#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to _fork_ `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebook/create-react-app/issues/682). +[Ejecting](available-scripts.md#npm-run-eject) lets you customize anything, but from that point on you have to maintain the configuration and scripts yourself. This can be daunting if you have many similar projects. In such cases instead of ejecting we recommend to _fork_ `react-scripts` and any other packages you need. [This article](https://auth0.com/blog/how-to-configure-create-react-app/) dives into how to do it in depth. You can find more discussion in [this issue](https://github.com/facebook/create-react-app/issues/682.md). diff --git a/docusaurus/docs/available-scripts.md b/docusaurus/docs/available-scripts.md index cb419d0c8eb..a6a32751926 100644 --- a/docusaurus/docs/available-scripts.md +++ b/docusaurus/docs/available-scripts.md @@ -14,7 +14,7 @@ The page will reload if you make edits. You will also see any lint errors in the ## `npm test` -Launches the test runner in the interactive watch mode. See the section about [running tests](docs/running-tests) for more information. +Launches the test runner in the interactive watch mode. See the section about [running tests](running-tests.md) for more information. ## `npm run build` @@ -22,7 +22,7 @@ Builds the app for production to the `build` folder. It correctly bundles React The build is minified and the filenames include the hashes. Your app is ready to be deployed! -See the section about [deployment](docs/deployment) for more information. +See the section about [deployment](deployment.md) for more information. ## `npm run eject` diff --git a/docusaurus/docs/deployment.md b/docusaurus/docs/deployment.md index e915ac58675..b3da65048d4 100644 --- a/docusaurus/docs/deployment.md +++ b/docusaurus/docs/deployment.md @@ -79,11 +79,11 @@ If you’re using [Apache Tomcat](http://tomcat.apache.org/), you need to follow Now requests to `/todos/42` will be handled correctly both in development and in production. -On a production build, and when you've [opted-in](docs/making-a-progressive-web-app#why-opt-in), +On a production build, and when you've [opted-in](making-a-progressive-web-app.md#why-opt-in), a [service worker](https://developers.google.com/web/fundamentals/primers/service-workers/) will automatically handle all navigation requests, like for `/todos/42`, by serving the cached copy of your `index.html`. This service worker navigation routing can be configured or disabled by -[`eject`ing](docs/available-scripts#npm-run-eject) and then modifying the +[`eject`ing](available-scripts.md#npm-run-eject) and then modifying the [`navigateFallback`](https://github.com/GoogleChrome/sw-precache#navigatefallback-string) and [`navigateFallbackWhitelist`](https://github.com/GoogleChrome/sw-precache#navigatefallbackwhitelist-arrayregexp) options of the `SWPreachePlugin` [configuration](../config/webpack.config.prod.js). diff --git a/docusaurus/docs/making-a-progressive-web-app.md b/docusaurus/docs/making-a-progressive-web-app.md index e796fca0530..2dd73e39f86 100644 --- a/docusaurus/docs/making-a-progressive-web-app.md +++ b/docusaurus/docs/making-a-progressive-web-app.md @@ -73,7 +73,7 @@ following into account: If your production web server does not support HTTPS, then the service worker registration will fail, but the rest of your web app will remain functional. -1. The service worker is only enabled in the [production environment](docs/deployment), +1. The service worker is only enabled in the [production environment](deployment.md), e.g. the output of `npm run build`. It's recommended that you do not enable an offline-first service worker in a development environment, as it can lead to frustration when previously cached assets are used and do not include the latest @@ -82,12 +82,12 @@ following into account: 1. If you _need_ to test your offline-first service worker locally, build the application (using `npm run build`) and run a simple http server from your build directory. After running the build script, `create-react-app` will give - instructions for one way to test your production build locally and the [deployment instructions](docs/deployment) have + instructions for one way to test your production build locally and the [deployment instructions](deployment.md) have instructions for using other methods. _Be sure to always use an incognito window to avoid complications with your browser cache._ 1. By default, the generated service worker file will not intercept or cache any - cross-origin traffic, like HTTP [API requests](docs/integrating-with-an-api-backend), + cross-origin traffic, like HTTP [API requests](integrating-with-an-api-backend.md), images, or embeds loaded from a different domain. ## Progressive Web App Metadata diff --git a/docusaurus/docs/proxying-api-requests-in-development.md b/docusaurus/docs/proxying-api-requests-in-development.md index 1713efc5333..3d27f7d96e6 100644 --- a/docusaurus/docs/proxying-api-requests-in-development.md +++ b/docusaurus/docs/proxying-api-requests-in-development.md @@ -38,7 +38,7 @@ If the `proxy` option is **not** flexible enough for you, alternatively you can: - [Configure the proxy yourself](#configuring-the-proxy-manually) - Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)). -- Use [environment variables](docs/adding-custom-environment-variables) to inject the right server host and port into your app. +- Use [environment variables](adding-custom-environment-variables.md) to inject the right server host and port into your app. ## "Invalid Host Header" Errors After Configuring Proxy diff --git a/docusaurus/docs/setting-up-your-editor.md b/docusaurus/docs/setting-up-your-editor.md index 75141a7e935..2f3aee04d7e 100644 --- a/docusaurus/docs/setting-up-your-editor.md +++ b/docusaurus/docs/setting-up-your-editor.md @@ -63,7 +63,7 @@ Then add the block below to your `launch.json` file and put it inside the `.vsco } ``` -> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](docs/advanced-configuration). +> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](advanced-configuration.md). Start your app by running `npm start`, and start debugging in VS Code by pressing `F5` or by clicking the green debug icon. You can now write code, set breakpoints, make changes to the code, and debug your newly modified code—all from your editor. @@ -75,7 +75,7 @@ You would need to have [WebStorm](https://www.jetbrains.com/webstorm/) and [JetB In the WebStorm menu `Run` select `Edit Configurations...`. Then click `+` and select `JavaScript Debug`. Paste `http://localhost:3000` into the URL field and save the configuration. -> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](docs/advanced-configuration). +> Note: the URL may be different if you've made adjustments via the [HOST or PORT environment variables](advanced-configuration.md). Start your app by running `npm start`, then press `^D` on macOS or `F9` on Windows and Linux or click the green debug icon to start debugging in WebStorm. diff --git a/docusaurus/docs/title-and-meta-tags.md b/docusaurus/docs/title-and-meta-tags.md index 8bac7e9cc23..0da67432532 100644 --- a/docusaurus/docs/title-and-meta-tags.md +++ b/docusaurus/docs/title-and-meta-tags.md @@ -8,11 +8,11 @@ sidebar_label: Title & Meta Tags You can find the source HTML file in the `public` folder of the generated project. You may edit the `<title>` tag in it to change the title from “React App” to anything else. -Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](docs/adding-a-stylesheet) is done without touching the HTML. +Note that normally you wouldn’t edit files in the `public` folder very often. For example, [adding a stylesheet](adding-a-stylesheet.md) is done without touching the HTML. If you need to dynamically update the page title based on the content, you can use the browser [`document.title`](https://developer.mozilla.org/en-US/docs/Web/API/Document/title) API. For more complex scenarios when you want to change the title from React components, you can use [React Helmet](https://github.com/nfl/react-helmet), a third party library. -If you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](docs/generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](docs/pre-rendering-into-static-html-files). +If you use a custom server for your app in production and want to modify the title before it gets sent to the browser, you can follow advice in [this section](#generating-dynamic-meta-tags-on-the-server). Alternatively, you can pre-build each page as a static HTML file which then loads the JavaScript bundle, which is covered [here](pre-rendering-into-static-html-files.md). ## Generating Dynamic `<meta>` Tags on the Server diff --git a/docusaurus/docs/troubleshooting.md b/docusaurus/docs/troubleshooting.md index a022a002e8a..06056a933f9 100644 --- a/docusaurus/docs/troubleshooting.md +++ b/docusaurus/docs/troubleshooting.md @@ -53,7 +53,7 @@ If you are completely sure that you didn't terminate the process, consider [addi ## `npm run build` fails on Heroku This may be a problem with case sensitive filenames. -Please refer to [this section](docs/deployment#resolving-heroku-deployment-errors). +Please refer to [this section](deployment.md#resolving-heroku-deployment-errors). ## Moment.js locales are missing diff --git a/docusaurus/docs/using-https-in-development.md b/docusaurus/docs/using-https-in-development.md index 717c71dcb88..207087153d8 100644 --- a/docusaurus/docs/using-https-in-development.md +++ b/docusaurus/docs/using-https-in-development.md @@ -6,7 +6,7 @@ sidebar_label: HTTPS in Development > Note: this feature is available with `react-scripts@0.4.0` and higher. -You may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the "proxy" feature](docs/proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS. +You may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the "proxy" feature](proxying-api-requests-in-development.md) to proxy requests to an API server when that API server is itself serving HTTPS. To do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`: diff --git a/docusaurus/docs/using-the-public-folder.md b/docusaurus/docs/using-the-public-folder.md index 69641904e18..89a43fbca3b 100644 --- a/docusaurus/docs/using-the-public-folder.md +++ b/docusaurus/docs/using-the-public-folder.md @@ -7,7 +7,7 @@ title: Using the Public Folder ## Changing the HTML -The `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](docs/changing-the-page-title). +The `public` folder contains the HTML file so you can tweak it, for example, to [set the page title](changing-the-page-title.md). The `<script>` tag with the compiled code will be added to it automatically during the build process. ## Adding Assets Outside of the Module System @@ -15,7 +15,7 @@ The `<script>` tag with the compiled code will be added to it automatically duri You can also add other assets to the `public` folder. Note that we normally encourage you to `import` assets in JavaScript files instead. -For example, see the sections on [adding a stylesheet](docs/adding-a-stylesheet) and [adding images and fonts](docs/adding-images-fonts-and-files). +For example, see the sections on [adding a stylesheet](adding-a-stylesheet.md) and [adding images and fonts](adding-images-fonts-and-files.md). This mechanism provides a number of benefits: - Scripts and stylesheets get minified and bundled together to avoid extra network requests. @@ -55,7 +55,7 @@ Keep in mind the downsides of this approach: ## When to Use the `public` Folder -Normally we recommend importing [stylesheets](docs/adding-a-stylesheet), [images, and fonts](docs/adding-images-fonts-and-files) from JavaScript. +Normally we recommend importing [stylesheets](adding-a-stylesheet.md), [images, and fonts](adding-images-fonts-and-files.md) from JavaScript. The `public` folder is useful as a workaround for a number of less common cases: - You need a file with a specific name in the build output, such as [`manifest.webmanifest`](https://developer.mozilla.org/en-US/docs/Web/Manifest).