Skip to content

Commit 7ea88af

Browse files
committed
Apply origin changes
1 parent 6b30d11 commit 7ea88af

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

guide/troubleshooting.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,45 @@ The error may also occur if the browser extensions (like ad-blockers) are blocki
189189

190190
It might be possible to work around by selecting a different chunk name by [`build.rollupOptions.output.chunkFileNames`](../config/build-options.md#build-rollupoptions), as these extensions often block requests based on file names (e.g. names containing `ad`, `track`).
191191

192+
### `Failed to fetch dynamically imported module` error
193+
194+
> TypeError: Failed to fetch dynamically imported module
195+
196+
This error occurs in several cases:
197+
198+
- Version skew
199+
- Poor network conditions
200+
- Browser extensions blocking requests
201+
202+
#### Version skew
203+
204+
When you deploy a new version of your application, the HTML file and the JS files still reference old chunk names that were deleted in the new deployment. This happens when:
205+
206+
1. Users have an old version of your app cached in their browser
207+
2. You deploy a new version with different chunk names (due to code changes)
208+
3. The cached HTML tries to load chunks that no longer exist
209+
210+
If you are using a framework, refer to their documentation first as it may have a built-in solution for this problem.
211+
212+
To resolve this, you can:
213+
214+
- **Keep old chunks temporarily**: Consider keeping the previous deployment's chunks for a period to allow cached users to transition smoothly.
215+
- **Use a service worker**: Implement a service worker that will prefetch all the assets and cache them.
216+
- **Prefetch the dynamic chunks**: Note that this does not help if your HTML file is cached by the browser due to `Cache-Control` headers.
217+
- **Implement a graceful fallback**: Implement error handling for dynamic imports to reload the page when chunks are missing. See [Load Error Handling](./build.md#load-error-handling) for more details.
218+
219+
#### Poor network conditions
220+
221+
This error may occur in unstable network environments. For example, when the request fails due to network errors or server downtime.
222+
223+
Note that you cannot retry the dynamic import due to browser limitations ([whatwg/html#6768](https://github.com/whatwg/html/issues/6768)).
224+
225+
#### Browser extensions blocking requests
226+
227+
The error may also occur if the browser extensions (like ad-blockers) are blocking that request.
228+
229+
It might be possible to work around by selecting a different chunk name by [`build.rollupOptions.output.chunkFileNames`](../config/build-options.md#build-rollupoptions), as these extensions often block requests based on file names (e.g. names containing `ad`, `track`).
230+
192231
## 디펜던시 최적화 {#optimized-dependencies}
193232

194233
### 링크된 로컬 패키지의 경우 사전 번들링 된 디펜던시가 갱신되지 않음 {#outdated-pre-bundled-deps-when-linking-to-a-local-package}
@@ -206,7 +245,11 @@ vite --profile --open
206245
```
207246

208247
```bash [빌드]
209-
vite build --profile
248+
Some browser extensions (like ad-blockers) may prevent the Vite client from sending requests to the Vite dev server. You may see a white screen without logged errors in this case. You may also see the following error:
249+
250+
> TypeError: Failed to fetch dynamically imported module
251+
252+
Try disabling extensions if you have this issue.
210253
```
211254
212255
:::

0 commit comments

Comments
 (0)