Skip to content

Commit 11ba089

Browse files
committed
update docs
1 parent ed05173 commit 11ba089

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

docs/guide/introduction.md

+31
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,37 @@ const { pdf } = usePDF(/** */)
139139

140140
Just be aware to set the `legacy` worker before use `usePDF`.
141141

142+
## Common issues
143+
144+
### Promise.withResolvers <badge type="tip" text="+v1.10" vertical="middle" />
145+
146+
> Promise.withResolvers is not a function
147+
148+
That throws because `Promise.withResolvers` is a relative "new feature" of JavaScript's Promises, even if almost all browsers [support it](https://caniuse.com/?search=withResolvers), in NodeJS this feature was fully included on version v22 as a base feature. To solve this issue consider updating node version if you are currently using a lower one.
149+
150+
### Top-level await is not available in the configured target environment <badge type="tip" text="+v1.10" vertical="middle" />
151+
152+
> [ERROR] Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)
153+
154+
This error is more related to ESBuild settings instead of compatibility matters, `Top-level await` is (as usually) a "new feature" of the JavaScript definition, practically all browsers [support it](https://caniuse.com/?search=top-level%20await) and was included on NodeJS since v14.
155+
156+
To solve this issue you will need to add this settings on `vite.config`:
157+
158+
```json
159+
optimizeDeps: {
160+
esbuildOptions: {
161+
supported: {
162+
'top-level-await': true,
163+
},
164+
},
165+
},
166+
esbuild: {
167+
supported: {
168+
'top-level-await': true,
169+
},
170+
}
171+
```
172+
142173
## Contributing
143174

144175
Any idea, suggestion or contribution to the code or documentation are very welcome.

packages/vue-pdf/README.md

+32
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,38 @@ const { pdf } = usePDF(/** */)
137137

138138
Just be aware to set the `legacy` worker before use `usePDF`.
139139

140+
## Common issues
141+
142+
### Promise.withResolvers
143+
144+
> Promise.withResolvers is not a function
145+
146+
That throws because `Promise.withResolvers` is a relative "new feature" of JavaScript's Promises, even if almost all browsers [support it](https://caniuse.com/?search=withResolvers), in NodeJS this feature was fully included on version v22 as a base feature. To solve this issue consider updating node version if you are currently using a lower one.
147+
148+
### Top-level await is not available in the configured target environment
149+
150+
> [ERROR] Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)
151+
152+
This error is more related to ESBuild settings instead of compatibility matters, `Top-level await` is (as usually) a "new feature" of the JavaScript definition, practically all browsers [support it](https://caniuse.com/?search=top-level%20await) and was included on NodeJS since v14.
153+
154+
To solve this issue you will need to add this settings on `vite.config`:
155+
156+
```json
157+
optimizeDeps: {
158+
esbuildOptions: {
159+
supported: {
160+
'top-level-await': true,
161+
},
162+
},
163+
},
164+
esbuild: {
165+
supported: {
166+
'top-level-await': true,
167+
},
168+
}
169+
```
170+
171+
140172
## Contributing
141173

142174
Any idea, suggestion or contribution to the code or documentation are very welcome.

0 commit comments

Comments
 (0)