Skip to content

Commit

Permalink
Merge pull request #11 from ModyQyW/main
Browse files Browse the repository at this point in the history
feat: align with `@vitejs/[email protected]`
  • Loading branch information
CyanSalt authored May 31, 2024
2 parents 4ba77c4 + c51e485 commit 786a8d8
Show file tree
Hide file tree
Showing 5 changed files with 935 additions and 603 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ export default {

Add custom imports to the legacy polyfills chunk. Since the usage-based polyfill detection only covers ES language features, it may be necessary to manually specify additional DOM API polyfills using this option.

Note: if additional polyfills are needed for both the modern and legacy chunks, they can simply be imported in the application source code.
### `additionalModernPolyfills`

- **Type:** `string[]`

Add custom imports to the modern polyfills chunk. Since the usage-based polyfill detection only covers ES language features, it may be necessary to manually specify additional DOM API polyfills using this option.

### `modernPolyfills`

Expand All @@ -99,9 +103,9 @@ export default {

Set to a list of strings to explicitly control which polyfills to include. See [Polyfill Specifiers](#polyfill-specifiers) for details.

Note it is **not recommended** to use the `true` value (which uses auto-detection) because `core-js@3` is very aggressive in polyfill inclusions due to all the bleeding edge features it supports. Even when targeting native ESM support, it injects 15kb of polyfills!
If `modernTargets` is not set, it is **not recommended** to use the `true` value (which uses auto-detection) because `core-js@3` is very aggressive in polyfill inclusions due to all the bleeding edge features it supports. Even when targeting native ESM support, it injects 15kb of polyfills!

If you don't have hard reliance on bleeding edge runtime features, it is not that hard to avoid having to use polyfills in the modern build altogether. Alternatively, consider using an on-demand service like [Polyfill.io](https://polyfill.io/v3/) to only inject necessary polyfills based on actual browser user-agents (most modern browsers will need nothing!).
If you don't have hard reliance on bleeding edge runtime features, it is not that hard to avoid having to use polyfills in the modern build altogether. Alternatively, consider setting `modernTargets` or using an on-demand service like [Polyfill.io](https://polyfill.io) to only inject necessary polyfills based on actual browser user-agents (most modern browsers will need nothing!).

### `renderLegacyChunks`

Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,28 @@
},
"homepage": "https://github.com/CyanSalt/vite-plugin-legacy-swc#readme",
"dependencies": {
"@swc/core": "^1.4.7",
"@swc/core": "^1.5.24",
"browserslist": "^4.23.0",
"browserslist-to-esbuild": "^2.1.1",
"core-js": "^3.36.0",
"magic-string": "^0.30.8",
"core-js": "^3.37.1",
"magic-string": "^0.30.10",
"regenerator-runtime": "^0.14.1",
"systemjs": "^6.14.3"
"systemjs": "^6.15.1"
},
"devDependencies": {
"@cyansalt/eslint-config": "^4.0.0",
"@cyansalt/eslint-config": "^4.0.5",
"@cyansalt/tsconfig": "^2.2.1",
"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^20.11.26",
"@types/node": "^20.12.13",
"acorn": "^8.11.3",
"eslint": "^9.3.0",
"picocolors": "^1.0.0",
"release-it": "^17.1.1",
"rollup": "^4.13.0",
"typescript": "^5.4.2",
"picocolors": "^1.0.1",
"release-it": "^17.3.0",
"rollup": "^4.18.0",
"typescript": "^5.4.5",
"unbuild": "^2.0.0",
"vite": "^5.1.6",
"vitest": "^1.3.1"
"vite": "^5.2.12",
"vitest": "^1.6.0"
},
"peerDependencies": {
"vite": ">=4.0.0"
Expand Down
Loading

0 comments on commit 786a8d8

Please sign in to comment.