Skip to content

Commit

Permalink
fix: use createBuiltinPluginWithEnvironmentSupport for transformPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 11, 2024
1 parent 75bca17 commit dfd18c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
18 changes: 12 additions & 6 deletions packages/vite/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,18 @@ export async function resolvePlugins(
htmlInlineProxyPlugin(config),
cssPlugin(config),
config.oxc !== false
? enableNativePlugin
? nativeTransformPlugin({
// TODO: how to jsx dev?
reactRefresh: rolldownDev?.reactRefresh,
})
: oxcPlugin(config)
? rolldownDev
? createBuiltinPluginWithEnvironmentSupport(
'native:transform',
(environment) =>
nativeTransformPlugin({
reactRefresh:
environment.name === 'client' && rolldownDev?.reactRefresh,
}),
)
: enableNativePlugin
? nativeTransformPlugin()
: oxcPlugin(config)
: null,
enableNativePlugin
? nativeJsonPlugin({
Expand Down
3 changes: 1 addition & 2 deletions packages/vite/src/node/server/environments/rolldown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ class RolldownEnvironment extends DevEnvironment {

// all plugins are shared like Vite 6 `sharedConfigBuild`.
let plugins = this._plugins!
// enable some core plugins
// TODO: adopt more (should we filter inside `resolvePlugins`?)
// TODO: enable more core plugins
plugins = plugins.filter(
(p) =>
!(typeof p.name === 'number' || p.name?.startsWith('vite:')) ||
Expand Down

0 comments on commit dfd18c5

Please sign in to comment.