You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Historically we have allowed specifying `NODE_PATH` environment variable as a way to allow “absolute imports”. For example, running `NODE_PATH=src npm start` in Bash or `set NODE_PATH=src&&npm start` in Windows Cmd would let you import anything inside `src` without specifying a relative path. However, we found a few nasty edge cases when Node.js core modules end up being in `NODE_PATH` and erroneously become bundled. As a result the build would crash on some systems when some libraries are imported. To fix this, we now only honor relative paths from `NODE_PATH` in Create React App. This means the existing use case for absolute imports is still supported (`src` in the example above is relative), but absolute paths in `NODE_PATH` (such as paths to Node.js core modules) will be ignored.
692
692
693
-
*[#1188](https://github.com/facebook/create-react-app/pull/1188) Update Webpack to fix source map issues. ([@gaearon](https://github.com/gaearon))
693
+
*[#1188](https://github.com/facebook/create-react-app/pull/1188) Update webpack to fix source map issues. ([@gaearon](https://github.com/gaearon))
694
694
695
-
Since 0.8.0, we show source maps in development instead of the compiled code. However, it has come to our attention that Webpack's source map implementation had issues interpreting Babel output, and caused source maps to be wrong and breakpoints to be unusable in some cases. Webpack has released a fix for this, and we have updated the minimal version of Webpack that we are using.
695
+
Since 0.8.0, we show source maps in development instead of the compiled code. However, it has come to our attention that webpack's source map implementation had issues interpreting Babel output, and caused source maps to be wrong and breakpoints to be unusable in some cases. webpack has released a fix for this, and we have updated the minimal version of webpack that we are using.
696
696
697
697
*[#1180](https://github.com/facebook/create-react-app/pull/1180) Use `file-loader` for svgs. ([@bogdansoare](https://github.com/bogdansoare))
698
698
@@ -945,7 +945,7 @@ Thanks to [@fson](https://github.com/fson) for cutting this release.
945
945
946
946
### ESLint Config (`eslint-config-react-app`)
947
947
948
-
* Adds `import/no-webpack-loader-syntax` rule that forbids using custom Webpack specific syntax to specify Webpack loaders in import statements. ([@fson](https://github.com/fson) in [#803](https://github.com/facebook/create-react-app/pull/803))
948
+
* Adds `import/no-webpack-loader-syntax` rule that forbids using custom webpack specific syntax to specify webpack loaders in import statements. ([@fson](https://github.com/fson) in [#803](https://github.com/facebook/create-react-app/pull/803))
949
949
*`react/react-in-jsx-scope` rule ("React must be in scope") is now an error. ([@gaearon](https://github.com/gaearon) in [#822](https://github.com/facebook/create-react-app/pull/822))
950
950
*`no-unused-expressions` rule now allows the use of short circuit and ternary expressions. ([@cannona](https://github.com/cannona) in [#724](https://github.com/facebook/create-react-app/pull/724))
951
951
@@ -958,7 +958,7 @@ Thanks to [@fson](https://github.com/fson) for cutting this release.
958
958
### Utilities (`react-dev-utils`)
959
959
960
960
* The error overlay is now disposed after fixing linting errors. ([@jarlef](https://github.com/jarlef) in [#856](https://github.com/facebook/create-react-app/pull/856))
961
-
* Adds support for Webpack 2 to `webpackHotDevClient`. ([@michalkvasnicak](https://github.com/michalkvasnicak) in [#840](https://github.com/facebook/create-react-app/pull/840))
961
+
* Adds support for webpack 2 to `webpackHotDevClient`. ([@michalkvasnicak](https://github.com/michalkvasnicak) in [#840](https://github.com/facebook/create-react-app/pull/840))
962
962
963
963
### Global CLI (`create-react-app`)
964
964
@@ -1201,7 +1201,7 @@ Paths like `/src/somefile.png` used to be served in development, but only by acc
1201
1201
1202
1202
If you need a static file to be part for the build, [import it from JavaScript and you will get its filename](https://github.com/facebook/create-react-app/blob/master/template/README.md#adding-images-and-fonts). This ensures it gets included into the production build as well, and its filename contains the content hash.
1203
1203
1204
-
If you used static files with `<link href>`, [read this new guide](https://github.com/facebook/create-react-app/blob/master/template/README.md#referring-to-static-assets-from-link-href) on how to make sure these files get included into the builds. For example, you can replace `<link href="/src/favicons/favicon-32.png">` with `<link href="./src/favicons/favicon-32.png">`, and then Webpack will recognize it and include it into the build.
1204
+
If you used static files with `<link href>`, [read this new guide](https://github.com/facebook/create-react-app/blob/master/template/README.md#referring-to-static-assets-from-link-href) on how to make sure these files get included into the builds. For example, you can replace `<link href="/src/favicons/favicon-32.png">` with `<link href="./src/favicons/favicon-32.png">`, and then webpack will recognize it and include it into the build.
1205
1205
1206
1206
If you referenced some other files from `index.html`, please file an issue to discuss your use case. In the meantime, you can serve them from a separate static server until your use case is supported.
1207
1207
@@ -1315,7 +1315,7 @@ Newly created projects will use `0.2.2` automatically. You **don’t** need to u
1315
1315
### Build Dependency (`react-scripts`)
1316
1316
1317
1317
* Fixes an issue with `npm start` taking a very long time on OS X with Firewall enabled ([@gaearon](https://github.com/gaearon) in [#319](https://github.com/facebook/create-react-app/pull/319))
1318
-
* Fixes an issue with Webpack eating a lot of CPU in some cases ([@dceddia](https://github.com/dceddia) in [#294](https://github.com/facebook/create-react-app/pull/294))
1318
+
* Fixes an issue with webpack eating a lot of CPU in some cases ([@dceddia](https://github.com/dceddia) in [#294](https://github.com/facebook/create-react-app/pull/294))
1319
1319
* We now warn if you import a file with mismatched casing because this breaks the watcher ([@alexzherdev](https://github.com/alexzherdev) in [#266](https://github.com/facebook/create-react-app/pull/266))
1320
1320
* CSS files specifying `?v=` after asset filenames, such as Font Awesome, now works correctly ([@alexzherdev](https://github.com/alexzherdev) in [#298](https://github.com/facebook/create-react-app/pull/298))
1321
1321
* Issues with `npm link`ing `react-scripts` have been fixed ([@dallonf](https://github.com/dallonf) in [#277](https://github.com/facebook/create-react-app/pull/277))
-[#3036](https://github.com/facebook/create-react-app/pull/3036) Cleaning up `printHostingInstructions` a bit. ([@GreenGremlin](https://github.com/GreenGremlin))
283
-
-[#3514](https://github.com/facebook/create-react-app/pull/3514) Fix `FileSizeReporter` for multi build Webpack setups. ([@iiska](https://github.com/iiska))
283
+
-[#3514](https://github.com/facebook/create-react-app/pull/3514) Fix `FileSizeReporter` for multi build webpack setups. ([@iiska](https://github.com/iiska))
284
284
-[#3362](https://github.com/facebook/create-react-app/pull/3362) Refactor extra watch options regex to `react-dev-utils`. ([@xjlim](https://github.com/xjlim))
285
285
286
286
#### Committers: 47
@@ -1104,7 +1104,7 @@ or
1104
1104
yarn add --dev --exact react-scripts@1.0.8
1105
1105
```
1106
1106
1107
-
**If you previously used `HTTPS=true` environment variable in development**, make sure you aren't affected by a now-fixed vulnerability in Webpack by [visiting this page](http://badcert.mike.works/). You can read more about the vulnerability [here](https://medium.com/@mikenorth/webpack-preact-cli-vulnerability-961572624c54).
1107
+
**If you previously used `HTTPS=true` environment variable in development**, make sure you aren't affected by a now-fixed vulnerability in webpack by [visiting this page](http://badcert.mike.works/). You can read more about the vulnerability [here](https://medium.com/@mikenorth/webpack-preact-cli-vulnerability-961572624c54).
1108
1108
1109
1109
You may optionally then move `react-scripts` from `devDependencies` to `dependencies` since that’s how we’ll structure newly created projects. It is not necessary though.
1110
1110
@@ -1724,7 +1724,7 @@ Please [file an issue](https://github.com/facebook/create-react-app/issues/new)
1724
1724
-`react-dev-utils`
1725
1725
-[#2125](https://github.com/facebook/create-react-app/pull/2125) Only show the first compilation error. ([@gaearon](https://github.com/gaearon))
1726
1726
-[#2120](https://github.com/facebook/create-react-app/pull/2120) Omit ESLint warnings when there are ESLint errors. ([@gaearon](https://github.com/gaearon))
1727
-
-[#2113](https://github.com/facebook/create-react-app/pull/2113) Prettify errors and warnings for Webpack 2. ([@gaearon](https://github.com/gaearon))
1727
+
-[#2113](https://github.com/facebook/create-react-app/pull/2113) Prettify errors and warnings for webpack 2. ([@gaearon](https://github.com/gaearon))
1728
1728
-[#1842](https://github.com/facebook/create-react-app/pull/1842) Modularize and extract crash overlay to iframe. ([@Timer](https://github.com/Timer))
1729
1729
-`create-react-app`
1730
1730
-[#1811](https://github.com/facebook/create-react-app/pull/1811) Allow creation of apps in empty Mercurial repos. ([@GreenGremlin](https://github.com/GreenGremlin))
@@ -1770,7 +1770,7 @@ Please [file an issue](https://github.com/facebook/create-react-app/issues/new)
1770
1770
-[#1736](https://github.com/facebook/create-react-app/pull/1736) Fix eject for linked react-scripts. ([@tuchk4](https://github.com/tuchk4))
-[#1715](https://github.com/facebook/create-react-app/pull/1715) Remove unused `url` import in Webpack config. ([@pd4d10](https://github.com/pd4d10))
1773
+
-[#1715](https://github.com/facebook/create-react-app/pull/1715) Remove unused `url` import in webpack config. ([@pd4d10](https://github.com/pd4d10))
1774
1774
-[#1700](https://github.com/facebook/create-react-app/pull/1700) Update extract-text-webpack-plugin to stable. ([@SimenB](https://github.com/SimenB))
1775
1775
-`react-dev-utils`, `react-scripts`
1776
1776
-[#2209](https://github.com/facebook/create-react-app/pull/2209) Move more logic from react-scripts to react-dev-utils. ([@gaearon](https://github.com/gaearon))
Copy file name to clipboardExpand all lines: CHANGELOG-2.x.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -827,7 +827,7 @@ You can read more about [these polyfills here](https://github.com/facebook/creat
827
827
828
828
### Dynamic `import()` of a CommonJS module now has a `.default` property
829
829
830
-
[Webpack 4 changed the behavior of `import()`](https://medium.com/webpack/webpack-4-import-and-commonjs-d619d626b655) to be closer in line with the specification.
830
+
[webpack 4 changed the behavior of `import()`](https://medium.com/webpack/webpack-4-import-and-commonjs-d619d626b655) to be closer in line with the specification.
831
831
832
832
Previously, importing a CommonJS module did not require you specify the default export. In most cases, this is now required.
833
833
If you see errors in your application about `... is not a function`, you likely need to update your dynamic import, e.g.:
@@ -973,7 +973,7 @@ If you used 2.x alphas, please [follow these instructions](https://gist.github.c
973
973
-`react-scripts`
974
974
-[#5218](https://github.com/facebook/create-react-app/pull/5218) Support globalSetup and globalTeardown Jest options ([@gaearon](https://github.com/gaearon))
975
975
-[#5073](https://github.com/facebook/create-react-app/pull/5073) Add user defined proxy via middleware ([@Timer](https://github.com/Timer))
976
-
-[#3945](https://github.com/facebook/create-react-app/pull/3945) Allow bundles to be analyzed with Webpack-specific tools ([@joshwcomeau](https://github.com/joshwcomeau))
976
+
-[#3945](https://github.com/facebook/create-react-app/pull/3945) Allow bundles to be analyzed with webpack-specific tools ([@joshwcomeau](https://github.com/joshwcomeau))
-[#3909](https://github.com/facebook/create-react-app/pull/3909) Add loader for .graphql files ([@petetnt](https://github.com/petetnt))
979
979
-[#1288](https://github.com/facebook/create-react-app/pull/1288) Create git repository with initial commit ([@mauricedb](https://github.com/mauricedb))
@@ -988,7 +988,7 @@ If you used 2.x alphas, please [follow these instructions](https://gist.github.c
988
988
-[#3865](https://github.com/facebook/create-react-app/pull/3865) Add opt-out for preset-flow to work with @babel/preset-typescript ([@oieduardorabelo](https://github.com/oieduardorabelo))
989
989
-[#3675](https://github.com/facebook/create-react-app/pull/3675) add experimental babel-plugin-macros support ([@kentcdodds](https://github.com/kentcdodds))
-[#4350](https://github.com/facebook/create-react-app/pull/4350) Support package distribution tags ([@miraage](https://github.com/miraage))
994
994
-`babel-preset-react-app`, `react-scripts`
@@ -1125,7 +1125,7 @@ If you used 2.x alphas, please [follow these instructions](https://gist.github.c
1125
1125
-[#4846](https://github.com/facebook/create-react-app/pull/4846) Update jest version ([@skoging](https://github.com/skoging))
1126
1126
-[#4362](https://github.com/facebook/create-react-app/pull/4362) Bumped jest version to 22.4.1 ([@CGreenburg](https://github.com/CGreenburg))
-[#4432](https://github.com/facebook/create-react-app/pull/4432) Update babel-plugin-macros to fix a bug ([@stereobooster](https://github.com/stereobooster))
1131
1131
-[#3818](https://github.com/facebook/create-react-app/pull/3818) Remove PropTypes from production build (#209) ([@iansu](https://github.com/iansu))
Copy file name to clipboardExpand all lines: README.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ When you’re ready to deploy to production, create a minified bundle with `npm
29
29
30
30
### Get Started Immediately
31
31
32
-
You **don’t** need to install or configure tools like Webpack or Babel.<br>
32
+
You **don’t** need to install or configure tools like webpack or Babel.<br>
33
33
They are preconfigured and hidden so that you can focus on the code.
34
34
35
35
Create a project, and you’re good to go.
@@ -134,7 +134,7 @@ Please refer to the [User Guide](https://facebook.github.io/create-react-app/doc
134
134
135
135
## Philosophy
136
136
137
-
-**One Dependency:** There is only one build dependency. It uses Webpack, Babel, ESLint, and other amazing projects, but provides a cohesive curated experience on top of them.
137
+
-**One Dependency:** There is only one build dependency. It uses webpack, Babel, ESLint, and other amazing projects, but provides a cohesive curated experience on top of them.
138
138
139
139
-**No Configuration Required:** You don't need to configure anything. A reasonably good configuration of both development and production builds is handled for you so you can focus on writing code.
140
140
@@ -169,7 +169,7 @@ Here are a few common cases where you might want to try something else:
169
169
170
170
- If you want to **try React** without hundreds of transitive build tool dependencies, consider [using a single HTML file or an online sandbox instead](https://reactjs.org/docs/try-react.html).
171
171
172
-
- If you need to **integrate React code with a server-side template framework** like Rails, Django or Symfony, or if you’re **not building a single-page app**, consider using [nwb](https://github.com/insin/nwb), or [Neutrino](https://neutrino.js.org/) which are more flexible. For Rails specifically, you can use [Rails Webpacker](https://github.com/rails/webpacker). For Symfony, try [Symfony's Webpack Encore](https://symfony.com/doc/current/frontend/encore/reactjs.html).
172
+
- If you need to **integrate React code with a server-side template framework** like Rails, Django or Symfony, or if you’re **not building a single-page app**, consider using [nwb](https://github.com/insin/nwb), or [Neutrino](https://neutrino.js.org/) which are more flexible. For Rails specifically, you can use [Rails Webpacker](https://github.com/rails/webpacker). For Symfony, try [Symfony's webpack Encore](https://symfony.com/doc/current/frontend/encore/reactjs.html).
173
173
174
174
- If you need to **publish a React component**, [nwb](https://github.com/insin/nwb) can [also do this](https://github.com/insin/nwb#react-components-and-libraries), as well as [Neutrino's react-components preset](https://neutrino.js.org/packages/react-components/).
Copy file name to clipboardExpand all lines: docusaurus/docs/adding-a-stylesheet.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Adding a Stylesheet
4
4
sidebar_label: Adding Stylesheets
5
5
---
6
6
7
-
This project setup uses [Webpack](https://webpack.js.org/) for handling all assets. Webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:
7
+
This project setup uses [webpack](https://webpack.js.org/) for handling all assets. webpack offers a custom way of “extending” the concept of `import` beyond JavaScript. To express that a JavaScript file depends on a CSS file, you need to **import the CSS from the JavaScript file**:
8
8
9
9
## `Button.css`
10
10
@@ -18,7 +18,7 @@ This project setup uses [Webpack](https://webpack.js.org/) for handling all asse
18
18
19
19
```js
20
20
importReact, { Component } from'react';
21
-
import'./Button.css'; // Tell Webpack that Button.js uses these styles
21
+
import'./Button.css'; // Tell webpack that Button.js uses these styles
22
22
23
23
classButtonextendsComponent {
24
24
render() {
@@ -28,8 +28,8 @@ class Button extends Component {
28
28
}
29
29
```
30
30
31
-
**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-blog/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.
31
+
**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-blog/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than webpack.
32
32
33
33
In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output.
34
34
35
-
If you are concerned about using Webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool.
35
+
If you are concerned about using webpack-specific semantics, you can put all your CSS right into `src/index.css`. It would still be imported from `src/index.js`, but you could always remove that import if you later migrate to a different build tool.
With Webpack, using static assets like images and fonts works similarly to CSS.
6
+
With webpack, using static assets like images and fonts works similarly to CSS.
7
7
8
-
You can **`import` a file right in a JavaScript module**. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF.
8
+
You can **`import` a file right in a JavaScript module**. This tells webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF.
9
9
10
10
To reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) instead of a path. This applies to the following file extensions: bmp, gif, jpg, jpeg, and png. SVG files are excluded due to [#1153](https://github.com/facebook/create-react-app/issues/1153). You can control the 10,000 byte threshold by setting the `IMAGE_INLINE_SIZE_LIMIT` environment variable as documented in our [advanced configuration](advanced-configuration.md).
11
11
12
12
Here is an example:
13
13
14
14
```js
15
15
importReactfrom'react';
16
-
importlogofrom'./logo.png'; // Tell Webpack this JS file uses this image
16
+
importlogofrom'./logo.png'; // Tell webpack this JS file uses this image
17
17
18
18
console.log(logo); // /logo.84287d09.png
19
19
@@ -25,7 +25,7 @@ function Header() {
25
25
exportdefaultHeader;
26
26
```
27
27
28
-
This ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths.
28
+
This ensures that when the project is built, webpack will correctly move the images into the build folder, and provide us with correct paths.
29
29
30
30
This works in CSS too:
31
31
@@ -35,9 +35,9 @@ This works in CSS too:
35
35
}
36
36
```
37
37
38
-
Webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes. If the file content changes in the future, Webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.
38
+
webpack finds all relative module references in CSS (they start with `./`) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by webpack from content hashes. If the file content changes in the future, webpack will give it a different name in production so you don’t need to worry about long-term caching of assets.
39
39
40
-
Please be advised that this is also a custom feature of Webpack.
40
+
Please be advised that this is also a custom feature of webpack.
41
41
42
42
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
Copy file name to clipboardExpand all lines: docusaurus/docs/available-scripts.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Your app is ready to be deployed! See the section about [deployment](deployment.
30
30
31
31
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
32
32
33
-
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc.) into your project as dependencies in `package.json`. Technically, the distinction between dependencies and development dependencies is pretty arbitrary for front-end apps that produce static bundles.
33
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc.) into your project as dependencies in `package.json`. Technically, the distinction between dependencies and development dependencies is pretty arbitrary for front-end apps that produce static bundles.
34
34
35
35
In addition, it used to cause problems with some hosting platforms that didn't install development dependencies (and thus weren't able to build the project on the server or test it right before deployment). You are free to rearrange your dependencies in `package.json` as you see fit.
Copy file name to clipboardExpand all lines: docusaurus/docs/folder-structure.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ For the project to build, **these files must exist with exact filenames**:
29
29
30
30
You can delete or rename the other files.
31
31
32
-
You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack. You need to **put any JS and CSS files inside `src`**, otherwise Webpack won’t see them.
32
+
You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by webpack. You need to **put any JS and CSS files inside `src`**, otherwise webpack won’t see them.
33
33
34
34
Only files inside `public` can be used from `public/index.html`. Read instructions below for using assets from JavaScript and HTML.
Copy file name to clipboardExpand all lines: docusaurus/docs/importing-a-component.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: importing-a-component
3
3
title: Importing a Component
4
4
---
5
5
6
-
This project setup supports ES6 modules thanks to Webpack.
6
+
This project setup supports ES6 modules thanks to webpack.
7
7
8
8
While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.
Copy file name to clipboardExpand all lines: docusaurus/docs/troubleshooting.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,9 @@ If this doesn’t happen, try one of the following workarounds:
12
12
13
13
- Check that your file is imported by your entrypoint. TypeScript will show errors on any of your source files, but webpack only reloads your files if they are directly or indirectly imported by one of your entrypoints.
14
14
- If your project is in a Dropbox folder, try moving it out.
15
-
- If the watcher doesn’t see a file called `index.js` and you’re referencing it by the folder name, you [need to restart the watcher](https://github.com/facebook/create-react-app/issues/1164) due to a Webpack bug.
15
+
- If the watcher doesn’t see a file called `index.js` and you’re referencing it by the folder name, you [need to restart the watcher](https://github.com/facebook/create-react-app/issues/1164) due to a webpack bug.
16
16
- Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in [“Adjusting Your Text Editor”](https://webpack.js.org/guides/development/#adjusting-your-text-editor).
17
-
- If your project path contains parentheses, try moving the project to a path without them. This is caused by a [Webpack watcher bug](https://github.com/webpack/watchpack/issues/42).
17
+
- If your project path contains parentheses, try moving the project to a path without them. This is caused by a [webpack watcher bug](https://github.com/webpack/watchpack/issues/42).
18
18
- On Linux and macOS, you might need to [tweak system settings](https://github.com/webpack/docs/wiki/troubleshooting#not-enough-watchers) to allow more watchers.
19
19
- If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an `.env` file in your project directory if it doesn’t exist, and add `CHOKIDAR_USEPOLLING=true` to it. This ensures that the next time you run `npm start`, the watcher uses the polling mode, as necessary inside a VM.
Copy file name to clipboardExpand all lines: docusaurus/docs/using-the-public-folder.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ This mechanism provides a number of benefits:
24
24
25
25
However there is an **escape hatch** that you can use to add an asset outside of the module system.
26
26
27
-
If you put a file into the `public` folder, it will **not** be processed by Webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use an environment variable called `PUBLIC_URL`.
27
+
If you put a file into the `public` folder, it will **not** be processed by webpack. Instead it will be copied into the build folder untouched. To reference assets in the `public` folder, you need to use an environment variable called `PUBLIC_URL`.
28
28
29
29
Inside `index.html`, you can use it like this:
30
30
@@ -61,6 +61,6 @@ The `public` folder is useful as a workaround for a number of less common cases:
61
61
- 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).
62
62
- You have thousands of images and need to dynamically reference their paths.
63
63
- You want to include a small script like [`pace.js`](https://github.hubspot.com/pace/docs/welcome/) outside of the bundled code.
64
-
- Some library may be incompatible with Webpack and you have no other option but to include it as a `<script>` tag.
64
+
- Some library may be incompatible with webpack and you have no other option but to include it as a `<script>` tag.
65
65
66
66
Note that if you add a `<script>` that declares global variables, you should read the topic [Using Global Variables](using-global-variables.md) in the next section which explains how to reference them.
Copy file name to clipboardExpand all lines: docusaurus/website/src/pages/index.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ const features = [
31
31
{
32
32
title: 'No Lock-In',
33
33
content:
34
-
'Under the hood, we use Webpack, Babel, ESLint, and other amazing projects to power your app. If you ever want an advanced configuration, you can ”eject” from Create React App and edit their config files directly.',
34
+
'Under the hood, we use webpack, Babel, ESLint, and other amazing projects to power your app. If you ever want an advanced configuration, you can ”eject” from Create React App and edit their config files directly.',
Copy file name to clipboardExpand all lines: packages/cra-template-typescript/template/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
33
33
34
34
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35
35
36
-
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
36
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37
37
38
38
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
Copy file name to clipboardExpand all lines: packages/cra-template/template/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
33
33
34
34
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35
35
36
-
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
36
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37
37
38
38
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
This Webpack plugin lets us interpolate custom variables into `index.html`.<br>
23
+
This webpack plugin lets us interpolate custom variables into `index.html`.<br>
24
24
It works in tandem with [HtmlWebpackPlugin](https://github.com/ampedandwired/html-webpack-plugin) 2.x via its [events](https://github.com/ampedandwired/html-webpack-plugin#events).
25
25
26
26
```js
27
27
var path =require('path');
28
28
var HtmlWebpackPlugin =require('html-webpack-plugin');
29
29
var InterpolateHtmlPlugin =require('react-dev-utils/InterpolateHtmlPlugin');
@@ -315,7 +315,7 @@ if (openBrowser('http://localhost:3000')) {
315
315
316
316
Prints hosting instructions after the project is built.
317
317
318
-
Pass your parsed `package.json` object as `appPackage`, your the URL where you plan to host the app as `publicUrl`, `output.publicPath` from your Webpack configuration as `publicPath`, the `buildFolder` name, and whether to `useYarn` in instructions.
318
+
Pass your parsed `package.json` object as `appPackage`, your the URL where you plan to host the app as `publicUrl`, `output.publicPath` from your webpack configuration as `publicPath`, the `buildFolder` name, and whether to `useYarn` in instructions.
319
319
320
320
```js
321
321
constappPackage=require(paths.appPackageJson);
@@ -332,7 +332,7 @@ Returns a Promise resolving to either `defaultPort` or next available port if th
0 commit comments