Skip to content

Commit

Permalink
chore: add faq
Browse files Browse the repository at this point in the history
  • Loading branch information
fupengl committed May 24, 2022
1 parent cf37e05 commit 02bd787
Showing 1 changed file with 49 additions and 17 deletions.
66 changes: 49 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Use `single-spa` `systemjs` in your `create-react-app`.

> Quickly adapt `react-scripts` as a submodule of single-spa !!!
> Quickly adapt `react-scripts` as a submodule of single-spa !!!
> Support `[email protected]` `[email protected]` version.
## Features

- Support `[email protected]` compatible with common configuration migrations
- Support `[email protected]` compatible with common configuration migrations
- Output `systemjs` library auto add `SystemJSPublicPathPlugin`
- Support `ReactFastRefresh` hot refresh

Expand Down Expand Up @@ -58,52 +58,84 @@ module.exports = {
## Options

### orgName
Type: `string`

Type: `string`
The name of the organization this application is written for.

### projectName
Type: `string`

Type: `string`
The name of the current project. This usually matches the git repo's name.

### entry
Type: `string`
Default: `src/{orgName}-{projectName}.{js|jsx|ts|tsx}` `src/index.{js|jsx|ts|tsx}`

Type: `string`
Default: `src/{orgName}-{projectName}.{js|jsx|ts|tsx}` `src/index.{js|jsx|ts|tsx}`
The entry file.

### outputFilename
Type: `string`
Default:
- development `{orgName}-{projectName}.[contenthash:8].js`
- production `{orgName}-{projectName}.js`

Type: `string`
Default:

- development `{orgName}-{projectName}.[contenthash:8].js`
- production `{orgName}-{projectName}.js`

### rootDirectoryLevel
Type: `number`

Type: `number`
This is the rootDirectoryLevel that is passed to https://github.com/joeldenning/systemjs-webpack-interop.

### reactPackagesAsExternal

Type: `boolean`
This will `react` `react-dom` as webpack externals or not.

### orgPackagesAsExternal
Type: `boolean`

Type: `boolean`
This changes whether package names that start with @your-org-name are treated as webpack externals or not.

### peerDepsAsExternal

Type: `boolean`
This will package.json `peerDependencies` as webpack externals or not.

## FQA

### FastRefresh invalid
- If `react` `react-dom` is external, `react-dev-tool` must be installed to refresh automatically.
For details, please see https://github.com/facebook/react/issues/17552

- If `react` `react-dom` is external, `react-dev-tool` must be installed to refresh automatically.
For details, please see https://github.com/facebook/react/issues/17552
- Check whether the ws connection is normal, you can set in `.env` file
- `WDS_SOCKET_PORT` "2002"
- `WDS_SOCKET_HOST` "localhost"
- `WDS_SOCKET_PATH` "/projectName" **Please start with "/"**
> The default hotreload client uses the relative website protocol,
which is the protocol of the main base. It can use the localhost
protocol and the local development port.
> The default hotreload client uses the relative website protocol,
> which is the protocol of the main base. It can use the localhost
> protocol and the local development port.
### webpack < 5 used to include polyfills for node.js core modules by default

The following packages have been integrated by default, and the specified dependencies can be installed directly in the project.

```json
{
"url": "url",
"fs": "fs",
"assert": "assert",
"crypto": "crypto-browserify",
"http": "stream-http",
"https": "https-browserify",
"os": "os-browserify/browser",
"buffer": "buffer",
"stream": "stream-browserify"
}
```

### You attempted to import XXXXXXXX which falls outside of the project src/ directory

You can use `customize-cra` `removeModuleScopePlugin()`

## License

Expand Down

0 comments on commit 02bd787

Please sign in to comment.