Skip to content

Commit 05d04a4

Browse files
gaearonromaindso
authored andcommitted
Move more logic from react-scripts to react-dev-utils (facebook#2209)
* Show warnings for builds * Move WebpackDevServer helpers into react-dev-utils
1 parent 5dfdae6 commit 05d04a4

File tree

9 files changed

+488
-457
lines changed

9 files changed

+488
-457
lines changed

packages/react-dev-utils/README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,25 @@ const publicPath = config.output.publicPath;
265265
printHostingInstructions(appPackage, publicUrl, publicPath, 'build', true);
266266
```
267267

268-
#### `webpackHotDevClient.js`
268+
#### `WebpackDevServerUtils`
269+
270+
##### `choosePort(host: string, defaultPort: number): Promise<number | null>`
271+
272+
Returns a Promise resolving to either `defaultPort` or next available port if the user confirms it is okay to do. If the port is taken and the user has refused to use another port, or if the terminal is not interactive and can’t present user with the choice, resolves to `null`.
273+
274+
##### `createCompiler(webpack: Function, config: Object, appName: string, urls: Object, useYarn: boolean): WebpackCompiler`
275+
276+
Creates a Webpack compiler instance for WebpackDevServer with built-in helpful messages. Takes the `require('webpack')` entry point as the first argument. To provide the `urls` argument, use `prepareUrls()` described below.
277+
278+
##### `prepareProxy(proxySetting: string): Object`
279+
280+
Creates a WebpackDevServer `proxy` configuration object from the `proxy` setting in `package.json`.
281+
282+
##### `prepareUrls(protocol: string, host: string, port: number): Object`
283+
284+
Returns an object with local and remote URLs for the development server. Pass this object to `createCompiler()` described above.
285+
286+
#### `webpackHotDevClient`
269287

270288
This is an alternative client for [WebpackDevServer](https://github.com/webpack/webpack-dev-server) that shows a syntax error overlay.
271289

0 commit comments

Comments
 (0)