Skip to content

Commit

Permalink
docs: remove dynamic import polyfill mentions
Browse files Browse the repository at this point in the history
  • Loading branch information
ludofischer committed Apr 27, 2021
1 parent e70e2da commit d5c6d4b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 29 deletions.
15 changes: 0 additions & 15 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
7 changes: 0 additions & 7 deletions docs/guide/backend-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion docs/guide/comparisons.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
6 changes: 0 additions & 6 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<link>` 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.).
Expand Down

0 comments on commit d5c6d4b

Please sign in to comment.