📜  将 TransformWithESBuild 与 Vite 一起使用 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:45.281000             🧑  作者: Mango

代码示例1
import {createRequire} from 'node:module'

const require = createRequire(import.meta.url)
const {transformWithEsbuild} = require('vite')

/** Transforms the JS/TS input using ESBuild */
const transformer = async (code:string):Promise=> (await transformWithEsbuild(code,`file.ts`,{minify: true})).code