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
Copy file name to clipboardExpand all lines: docs/guide/backend-integration.md
+36-13Lines changed: 36 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,6 +75,10 @@ If you need a custom integration, you can follow the steps in this guide to conf
75
75
"file": "assets/shared-ChJ_j-JJ.css",
76
76
"src": "_shared-ChJ_j-JJ.css"
77
77
},
78
+
"logo.svg": {
79
+
"file": "assets/logo-BuPIv-2h.svg",
80
+
"src": "logo.svg"
81
+
},
78
82
"baz.js": {
79
83
"file": "assets/baz-B2H3sXNv.js",
80
84
"name": "baz",
@@ -100,11 +104,31 @@ If you need a custom integration, you can follow the steps in this guide to conf
100
104
}
101
105
```
102
106
103
-
- The manifest has a `Record<name, chunk>` structure
104
-
- For entry or dynamic entry chunks, the key is the relative src path from project root.
105
-
- For non entry chunks, the key is the base name of the generated file prefixed with `_`.
106
-
- For the CSS file generated when [`build.cssCodeSplit`](/config/build-options.md#build-csscodesplit) is `false`, the key is `style.css`.
107
-
- Chunks will contain information on its static and dynamic imports (both are keys that map to the corresponding chunk in the manifest), and also its corresponding CSS and asset files (if any).
107
+
The manifest has a `Record<name, chunk>` structure where each chunk follows the `ManifestChunk` interface:
108
+
109
+
```ts
110
+
interfaceManifestChunk {
111
+
src?:string
112
+
file:string
113
+
css?:string[]
114
+
assets?:string[]
115
+
isEntry?:boolean
116
+
name?:string
117
+
names?:string[]
118
+
isDynamicEntry?:boolean
119
+
imports?:string[]
120
+
dynamicImports?:string[]
121
+
}
122
+
```
123
+
124
+
Each entry in the manifest represents one of the following:
125
+
-**Entry chunks**: Generated from files specified in [`build.rollupOptions.input`](https://rollupjs.org/configuration-options/#input). These chunks have `isEntry: true` and their key is the relative src path from project root.
126
+
-**Dynamic entry chunks**: Generated from dynamic imports. These chunks have `isDynamicEntry: true` and their key is the relative src path from project root.
127
+
-**Non-entry chunks**: Their key is the base name of the generated file prefixed with `_`.
128
+
-**Asset chunks**: Generated from imported assets like images, fonts. Their key is the relative src path from project root.
129
+
-**CSS files**: When [`build.cssCodeSplit`](/config/build-options.md#build-csscodesplit) is `false`, a single CSS file is generated with the key `style.css`. When `build.cssCodeSplit` is not `false`, the key is generated similar to JS chunks (i.e. entry chunks will not have `_` prefix and non-entry chunks will have `_` prefix).
130
+
131
+
Chunks will contain information on their static and dynamic imports (both are keys that map to the corresponding chunk in the manifest), and also their corresponding CSS and asset files (if any).
108
132
109
133
4. You can use this file to render links or preload directives with hashed filenames.
110
134
@@ -129,14 +153,13 @@ If you need a custom integration, you can follow the steps in this guide to conf
129
153
```
130
154
131
155
Specifically, a backend generating HTML should include the following tags given a manifest
132
-
file and an entry point:
133
-
- A `<link rel="stylesheet">` tag for each file in the entry point chunk's `css` list
134
-
- Recursively follow all chunks in the entry point's `imports` list and include a
135
-
`<link rel="stylesheet">` tag for each CSS file of each imported chunk.
136
-
- A tag for the `file` key of the entry point chunk (`<script type="module">` for JavaScript,
137
-
or `<link rel="stylesheet">` for CSS)
138
-
- Optionally, `<link rel="modulepreload">` tag for the `file` of each imported JavaScript
139
-
chunk, again recursively following the imports starting from the entry point chunk.
156
+
file and an entry point. Note that following this order is recommended for optimal performance:
157
+
1. A `<link rel="stylesheet">` tag for each file in the entry point chunk's `css` list (if it exists)
158
+
2. Recursively follow all chunks in the entry point's `imports` list and include a
159
+
`<link rel="stylesheet">` tag for each CSS file of each imported chunk's `css` list (if it exists).
160
+
3. A tag for the `file` key of the entry point chunk. This can be `<script type="module">` for JavaScript, `<link rel="stylesheet">` for CSS.
161
+
4. Optionally, `<link rel="modulepreload">` tag for the `file` of each imported JavaScript
162
+
chunk, again recursively following the imports starting from the entry point chunk.
140
163
141
164
Following the above example manifest, for the entry point `views/foo.js` the following tags should be included in production:
0 commit comments