From d5c6d4bf64c0b77aca71b56338e380a57bded246 Mon Sep 17 00:00:00 2001 From: Ludovico Fischer Date: Tue, 27 Apr 2021 19:27:08 +0200 Subject: [PATCH] docs: remove dynamic import polyfill mentions --- docs/config/index.md | 15 --------------- docs/guide/backend-integration.md | 7 ------- docs/guide/comparisons.md | 1 - docs/guide/features.md | 6 ------ 4 files changed, 29 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index 98fd6234fd480a..5f6421644628d4 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -443,21 +443,6 @@ export default async ({ command, mode }) => { Note the build will fail if the code contains features that cannot be safely transpiled by esbuild. See [esbuild docs](https://esbuild.github.io/content-types/#javascript) for more details. -### build.polyfillDynamicImport - -- **Type:** `boolean` -- **Default:** `true` unless `build.target` is `'esnext'` - - Whether to automatically inject [dynamic import polyfill](https://github.com/GoogleChromeLabs/dynamic-import-polyfill). - - The polyfill is auto injected into the proxy module of each `index.html` entry. If the build is configured to use a non-html custom entry via `build.rollupOptions.input`, then it is necessary to manually import the polyfill in your custom entry: - - ```js - import 'vite/dynamic-import-polyfill' - ``` - - Note: the polyfill does **not** apply to [Library Mode](/guide/build#library-mode). If you need to support browsers without native dynamic import, you should probably avoid using it in your library. - ### build.outDir - **Type:** `string` diff --git a/docs/guide/backend-integration.md b/docs/guide/backend-integration.md index 4669bd6c818dec..fad9fff75c61d6 100644 --- a/docs/guide/backend-integration.md +++ b/docs/guide/backend-integration.md @@ -20,13 +20,6 @@ Or you can follow these steps to configure it manually: } ``` - Also remember to add the [dynamic import polyfill](/config/#build-polyfilldynamicimport) to your entry, since it will no longer be auto-injected: - - ```js - // add the beginning of your app entry - import 'vite/dynamic-import-polyfill' - ``` - 2. For development, inject the following in your server's HTML template (substitute `http://localhost:3000` with the local URL Vite is running at): ```html diff --git a/docs/guide/comparisons.md b/docs/guide/comparisons.md index 3e944d9b23aba5..1e849f88a71a68 100644 --- a/docs/guide/comparisons.md +++ b/docs/guide/comparisons.md @@ -16,7 +16,6 @@ Due to a more integrated build process, Vite supports a wide range of features t - [Library Mode](./build#library-mode) - [Automatic CSS code-splitting](./features#css-code-splitting) - [Optimized async chunk loading](./features#async-chunk-loading-optimization) -- [Automatic dynamic import polyfill](./features#dynamic-import-polyfill) - Official [legacy mode plugin](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) that generates dual modern/legacy bundles and auto delivers the right bundle based on browser support. **Faster Dependency Pre-Bundling** diff --git a/docs/guide/features.md b/docs/guide/features.md index b9b343bad1ad1b..e30ba02f48ddf9 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -304,12 +304,6 @@ import MyWorker from './worker?worker&inline' > Features listed below are automatically applied as part of the build process and there is no need for explicit configuration unless you want to disable them. -### Dynamic Import Polyfill - -Vite uses ES dynamic import as code-splitting points. The generated code will also use dynamic imports to load the async chunks. However, native ESM dynamic imports support landed later than ESM via script tags and there is a browser support discrepancy between the two features. Vite automatically injects a light-weight [dynamic import polyfill](https://github.com/GoogleChromeLabs/dynamic-import-polyfill) to ease out that difference. - -If you know you are only targeting browsers with native dynamic import support, you can explicitly disable this feature via [`build.polyfillDynamicImport`](/config/#build-polyfilldynamicimport). - ### CSS Code Splitting Vite automatically extracts the CSS used by modules in an async chunk and generate a separate file for it. The CSS file is automatically loaded via a `` tag when the associated async chunk is loaded, and the async chunk is guaranteed to only be evaluated after the CSS is loaded to avoid [FOUC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content#:~:text=A%20flash%20of%20unstyled%20content,before%20all%20information%20is%20retrieved.).