Skip to content

Conversation

@shulaoda
Copy link
Member

@shulaoda shulaoda commented Nov 4, 2025

Description

If you want to enable these new native plugins, you need to set enableNativePlugin: true, the default value is 'v2'. The v3 native plugins include assetPlugin, assetImportMetaUrlPlugin, cssPlugin, htmlPlugin, htmlInlineProxyPlugin, improved nativeManifestPlugin and nativeBuildImportAnalysisPlugin.

Warning

We've identified cases in the third-party ecosystem where plugins invoke hooks of the vite:css or vite:css-post built-in plugins, such as unocss/unocss, ArnaudBarre/downwind, privatenumber/vite-css-modules, and redfox-mx/vite-lit-css. After migrating to native plugins, we need to find appropriate solutions for these use cases. See https://github.com/search?q=vite%3Acss-post&type=code

@shulaoda shulaoda marked this pull request as draft November 4, 2025 15:57
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch 2 times, most recently from ecc5731 to 165a101 Compare November 5, 2025 10:03
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch 12 times, most recently from 097a16d to 747c24e Compare November 17, 2025 01:01
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch 7 times, most recently from ce51c11 to 9ee6920 Compare November 26, 2025 09:41
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch 6 times, most recently from dba3281 to d6b9c56 Compare December 3, 2025 01:14
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch from d6b9c56 to 6eddf7b Compare December 3, 2025 01:21
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch from 6eddf7b to 689f9ba Compare December 3, 2025 01:23
renderBuiltUrl: undefined,
hmrPartialAccept: false,
enableNativePlugin: process.env._VITE_TEST_JS_PLUGIN ? false : 'v1',
enableNativePlugin: process.env._VITE_TEST_JS_PLUGIN ? false : true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be reverted before merging.

@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch from 689f9ba to 122013a Compare December 3, 2025 01:42
@shulaoda shulaoda marked this pull request as ready for review December 3, 2025 01:52
@shulaoda shulaoda requested a review from sapphi-red December 3, 2025 01:52
case 'v1':
case true:
return 1
case true:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case true:
case 'v2':
case true:

We should also update the jsdoc of enableNativePlugin option.

Copy link
Member Author

@shulaoda shulaoda Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm considering not adding the v2 option since the v2 implementation is still experimental and not fully stable. My current idea is to treat enableNativePlugin: true as enabling v2, while keeping v1 as the default behavior. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think? @sapphi-red

@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch 2 times, most recently from f627dd0 to 4c5f53a Compare December 3, 2025 07:26
@shulaoda shulaoda requested a review from sapphi-red December 3, 2025 07:26
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch 3 times, most recently from 51dfefc to 0b387c5 Compare December 3, 2025 07:32
@shulaoda shulaoda marked this pull request as draft December 3, 2025 07:39
@vitejs vitejs deleted a comment from sapphi-red Dec 9, 2025
@shulaoda shulaoda force-pushed the 10-20-stable-v2-native-plugins branch from 0b387c5 to 97a4abe Compare December 10, 2025 09:33
@shulaoda
Copy link
Member Author

@sapphi-red Could you help me trigger the ecosystem CI? It seems I don’t have permission to do it.

@sapphi-red
Copy link
Member

Triggered here: https://github.com/vitejs/vite-ecosystem-ci/actions/runs/20097924150

@shulaoda shulaoda marked this pull request as ready for review December 11, 2025 09:57
@shulaoda shulaoda changed the title feat: stable v2 native plugins feat: introduce experimental v2 native plugins Dec 11, 2025
@shulaoda
Copy link
Member Author

I found some issues in the Vite ecosystem, and I’ll address them later.

@shulaoda shulaoda marked this pull request as draft December 11, 2025 10:07
@shulaoda shulaoda changed the title feat: introduce experimental v2 native plugins feat: introduce experimental v3 native plugins Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants