|
2 | 2 |
|
3 | 3 | Use `single-spa` `systemjs` in your `create-react-app`. |
4 | 4 |
|
5 | | -> Quickly adapt `react-scripts` as a submodule of single-spa !!! |
| 5 | +> Quickly adapt `react-scripts` as a submodule of single-spa !!! |
6 | 6 | > Support `react-scripts@4.x` `react-scripts@5.x` version. |
7 | 7 |
|
8 | 8 | ## Features |
9 | 9 |
|
10 | | -- Support `react-scripts@5.x` compatible with common configuration migrations |
| 10 | +- Support `react-scripts@5.x` compatible with common configuration migrations |
11 | 11 | - Output `systemjs` library auto add `SystemJSPublicPathPlugin` |
12 | 12 | - Support `ReactFastRefresh` hot refresh |
13 | 13 |
|
@@ -58,52 +58,84 @@ module.exports = { |
58 | 58 | ## Options |
59 | 59 |
|
60 | 60 | ### orgName |
61 | | -Type: `string` |
| 61 | + |
| 62 | +Type: `string` |
62 | 63 | The name of the organization this application is written for. |
63 | 64 |
|
64 | 65 | ### projectName |
65 | | -Type: `string` |
| 66 | + |
| 67 | +Type: `string` |
66 | 68 | The name of the current project. This usually matches the git repo's name. |
67 | 69 |
|
68 | 70 | ### entry |
69 | | -Type: `string` |
70 | | -Default: `src/{orgName}-{projectName}.{js|jsx|ts|tsx}` `src/index.{js|jsx|ts|tsx}` |
| 71 | + |
| 72 | +Type: `string` |
| 73 | +Default: `src/{orgName}-{projectName}.{js|jsx|ts|tsx}` `src/index.{js|jsx|ts|tsx}` |
71 | 74 | The entry file. |
72 | 75 |
|
73 | 76 | ### outputFilename |
74 | | -Type: `string` |
75 | | -Default: |
76 | | - - development `{orgName}-{projectName}.[contenthash:8].js` |
77 | | - - production `{orgName}-{projectName}.js` |
| 77 | + |
| 78 | +Type: `string` |
| 79 | +Default: |
| 80 | + |
| 81 | +- development `{orgName}-{projectName}.[contenthash:8].js` |
| 82 | +- production `{orgName}-{projectName}.js` |
78 | 83 |
|
79 | 84 | ### rootDirectoryLevel |
80 | | -Type: `number` |
| 85 | + |
| 86 | +Type: `number` |
81 | 87 | This is the rootDirectoryLevel that is passed to https://github.com/joeldenning/systemjs-webpack-interop. |
82 | 88 |
|
83 | 89 | ### reactPackagesAsExternal |
| 90 | + |
84 | 91 | Type: `boolean` |
85 | 92 | This will `react` `react-dom` as webpack externals or not. |
86 | 93 |
|
87 | 94 | ### orgPackagesAsExternal |
88 | | -Type: `boolean` |
| 95 | + |
| 96 | +Type: `boolean` |
89 | 97 | This changes whether package names that start with @your-org-name are treated as webpack externals or not. |
90 | 98 |
|
91 | 99 | ### peerDepsAsExternal |
| 100 | + |
92 | 101 | Type: `boolean` |
93 | 102 | This will package.json `peerDependencies` as webpack externals or not. |
94 | 103 |
|
95 | 104 | ## FQA |
96 | 105 |
|
97 | 106 | ### FastRefresh invalid |
98 | | -- If `react` `react-dom` is external, `react-dev-tool` must be installed to refresh automatically. |
99 | | -For details, please see https://github.com/facebook/react/issues/17552 |
| 107 | + |
| 108 | +- If `react` `react-dom` is external, `react-dev-tool` must be installed to refresh automatically. |
| 109 | + For details, please see https://github.com/facebook/react/issues/17552 |
100 | 110 | - Check whether the ws connection is normal, you can set in `.env` file |
101 | 111 | - `WDS_SOCKET_PORT` "2002" |
102 | 112 | - `WDS_SOCKET_HOST` "localhost" |
103 | 113 | - `WDS_SOCKET_PATH` "/projectName" **Please start with "/"** |
104 | | - > The default hotreload client uses the relative website protocol, |
105 | | - which is the protocol of the main base. It can use the localhost |
106 | | - protocol and the local development port. |
| 114 | + > The default hotreload client uses the relative website protocol, |
| 115 | + > which is the protocol of the main base. It can use the localhost |
| 116 | + > protocol and the local development port. |
| 117 | +
|
| 118 | +### webpack < 5 used to include polyfills for node.js core modules by default |
| 119 | + |
| 120 | +The following packages have been integrated by default, and the specified dependencies can be installed directly in the project. |
| 121 | + |
| 122 | +```json |
| 123 | +{ |
| 124 | + "url": "url", |
| 125 | + "fs": "fs", |
| 126 | + "assert": "assert", |
| 127 | + "crypto": "crypto-browserify", |
| 128 | + "http": "stream-http", |
| 129 | + "https": "https-browserify", |
| 130 | + "os": "os-browserify/browser", |
| 131 | + "buffer": "buffer", |
| 132 | + "stream": "stream-browserify" |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | +### You attempted to import XXXXXXXX which falls outside of the project src/ directory |
| 137 | + |
| 138 | +You can use `customize-cra` `removeModuleScopePlugin()` |
107 | 139 |
|
108 | 140 | ## License |
109 | 141 |
|
|
0 commit comments