You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-c, --config Path to custom CLI config (default preact.config.js)
153
154
-H, --host Set server hostname (default 0.0.0.0)
154
155
-p, --port Set server port (default 8080)
@@ -172,18 +173,6 @@ $ preact list
172
173
173
174
Prints debugging information concerning the local environment.
174
175
175
-
### Deploying
176
-
177
-
```sh
178
-
# create a production build:
179
-
npm run build
180
-
181
-
# generate configuration in Firebase Hosting format:
182
-
npm run serve -- --server config
183
-
184
-
# Copy your static files to a server!
185
-
```
186
-
187
176
### Pre-rendering
188
177
189
178
Preact CLI in order to follow [PRPL] pattern renders initial route (`/`) into generated static `index.html` - this ensures that users get to see your page before any JavaScript is run, and thus providing users with slow devices or poor connection your website's content much faster.
@@ -308,7 +297,7 @@ module.exports = [
308
297
309
298
#### Template
310
299
311
-
A template is used to render your page by [EJS](https://ejs.co/).
300
+
A template is used to render your page by [EJS](https://ejs.co/).
312
301
You can uses the data of `prerenderUrls` which does not have `title`, using `htmlWebpackPlugin.options.CLI_DATA.preRenderData` in EJS.
313
302
314
303
The default one is visible [here](packages/cli/lib/resources/template.html) and it's going to be enough for the majority of cases.
@@ -352,36 +341,6 @@ export default {
352
341
353
342
If you'd like to use these variables in your application, you can use the [DefinePlugin] config from our recipes wiki.
"Route" components are automatically code-splitted at build time to create smaller bundles and avoid loading more code than is needed by each page. This works by intercepting imports for route components with an [async loader](https://github.com/preactjs/preact-cli/tree/master/packages/async-loader), which returns a lightweight wrapper component that handles code splitting seamlessly.
@@ -411,7 +370,7 @@ Automatic code splitting is applied to all JavaScript and TypeScript files in th
411
370
</td></tr>
412
371
</tbody></table>
413
372
414
-
> **Note**:
373
+
> **Note**:
415
374
> Automatic code splitting **only** supports default exports, not named exports:
416
375
>
417
376
> ```diff
@@ -420,3 +379,32 @@ Automatic code splitting is applied to all JavaScript and TypeScript files in th
420
379
> ```
421
380
>
422
381
> This is an intentional limitation that ensures effective code splitting. For components that need named exports, place them in a directory that doesn't trigger automatic code splitting. You can then manually code-split the default export by re-exporting it from `routes/` or importing it with the `"async!"` prefix.
0 commit comments