npm package: @intellihr/portal-dev-utils
Description: Webpack utilities used by Portal
Author: Alfred See
Latest version: 2.0.0

<h1>@intellihr/portal-dev-utils</h1>

This package includes some utilities used by [Portal](https://github.com/intellihr/portal) microservices.

<h2>Table of Contents</h2>

- [Usage](#usage)
  - [Entry Points](#entry-points)
  - [`new PortalManifestWebpackPlugin(options: Object)`](#new-portalmanifestwebpackpluginoptions-object)
    - [`options.filename`](#optionsfilename)
    - [`options.seed`](#optionsseed)
  - [`WebpackDevServerUtils`](#webpackdevserverutils)
    - [`createMultiCompiler(options: Object): WebpackMultiCompiler`](#createmulticompileroptions-object-webpackmulticompiler)
      - [`appName`](#appname)
      - [`configs`](#configs)
      - [`devSocket`](#devsocket)
      - [`urls`](#urls)
      - [`useYarn`](#useyarn)
      - [`useTypeScript`](#usetypescript)
      - [`tscCompileOnError`](#tsccompileonerror)
      - [`webpack`](#webpack)

## Usage

If you don't use Portal, you may keep using these utilities. Feel free to fork or copy and paste them into your projects if you'd like to have more control over them. Not all of them are Portal-specific, but we might make some of them more Portal-specific in the future.

### Entry Points
There is no single entry point. You can only import individual top-level modules.

### `new PortalManifestWebpackPlugin(options: Object)`
This Webpack plugin generates a manifest file to be used by Portal.

#### `options.filename`

Type: `String`<br />
Default: `portal-manifest.json`

By default the plugin will emit `portal-manifest.json` to your output directory.

#### `options.seed`

Type: `Object`<br />
Default: `{}`

A cache of key/value pairs to seed the manifest. This may be used to combine manifests across compilations in [multi-compiler mode](https://github.com/webpack/webpack/tree/master/examples/multi-compiler). To combine manifests, pass a shared seed object to each compiler's PortalManifestWebpackPlugin instance.

### `webpack-dev-server-utils`

#### `createMultiCompiler(options: Object): WebpackMultiCompiler`
Creates a Webpack multi-compiler instance for WebpackDevServer with built-in helpful messages.

##### `options.appName`

Type: `String`

The name that will be printed to the terminal.

##### `options.configs`

Type: `Object[]`

A list of sets of webpack configuration options to be provided to the webpack constructor.

##### `options.devSocket`

Type: `Object`

Required if `useTypeScript` is `true`. This object should include `errors` and `warnings` which are functions accepting an array of errors or warnings emitted by the type checking. This is useful when running `fork-ts-checker-webpack-plugin` with `async: true` to report errors that are emitted after the webpack build is complete.

##### `options.urls`

Type: `Object`

To provide the `urls` argument, use `react-dev-utils/WebpackDevServerUtils@prepareUrls()`.

##### `options.useYarn`

Type: `boolean`

If `true`, yarn instruction will be emitted in the terminal instead of npm.

##### `options.useTypeScript`

Type: `boolean`

If `true`, TypeScript type checking will be enabled. Be sure to provide the `devSocket` argument above if this is set to `true`.

##### `options.tscCompileOnError`

Type: `boolean`

If `true`, errors in TypeScript type checking will not prevent start script from running app, and will not cause build script to exit unsuccessfully. Also downgrades all TypeScript type checking error messages to warning messages.

##### `options.webpack`

Type: `function`

A reference to the webpack constructor.