mirror of
https://github.com/egoist/tsup.git
synced 2026-02-01 16:57:42 +00:00
chore: tweaks
This commit is contained in:
parent
7f2660c8ef
commit
dfab78e840
@ -1,3 +1,4 @@
|
||||
import { PrettyError } from '../errors'
|
||||
import { Plugin } from '../plugin'
|
||||
import { localRequire } from '../utils'
|
||||
|
||||
@ -18,6 +19,13 @@ export const es5 = (): Plugin => {
|
||||
return
|
||||
}
|
||||
const swc: typeof import('@swc/core') = localRequire('@swc/core')
|
||||
|
||||
if (!swc) {
|
||||
throw new PrettyError(
|
||||
'@swc/core is required for es5 target. Please install it with `npm install @swc/core -D`'
|
||||
)
|
||||
}
|
||||
|
||||
const result = await swc.transform(code, {
|
||||
filename: info.path,
|
||||
sourceMaps: this.options.sourcemap,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user