one
Version:
One is a new React Framework that makes Vite serve both native and web.
17 lines (13 loc) • 324 B
text/typescript
import type { Plugin } from 'vite'
export function makePluginWebOnly(plugin: Plugin) {
const og = plugin.transform as any
if (og) {
plugin.transform = function (this, ...args) {
if (this.environment.name !== 'client') {
return
}
return og.call(this, ...args)
}
}
return plugin
}