Skip to content

Commit

Permalink
Move more logic from react-scripts to react-dev-utils (facebook#2209)
Browse files Browse the repository at this point in the history
* Show warnings for builds

* Move WebpackDevServer helpers into react-dev-utils
  • Loading branch information
gaearon authored and romaindso committed Jul 10, 2017
1 parent 5dfdae6 commit 05d04a4
Show file tree
Hide file tree
Showing 9 changed files with 488 additions and 457 deletions.
20 changes: 19 additions & 1 deletion packages/react-dev-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,25 @@ const publicPath = config.output.publicPath;
printHostingInstructions(appPackage, publicUrl, publicPath, 'build', true);
```

#### `webpackHotDevClient.js`
#### `WebpackDevServerUtils`

##### `choosePort(host: string, defaultPort: number): Promise<number | null>`

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`.

##### `createCompiler(webpack: Function, config: Object, appName: string, urls: Object, useYarn: boolean): WebpackCompiler`

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.

##### `prepareProxy(proxySetting: string): Object`

Creates a WebpackDevServer `proxy` configuration object from the `proxy` setting in `package.json`.

##### `prepareUrls(protocol: string, host: string, port: number): Object`

Returns an object with local and remote URLs for the development server. Pass this object to `createCompiler()` described above.

#### `webpackHotDevClient`

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

Expand Down
Loading

0 comments on commit 05d04a4

Please sign in to comment.