Skip to content

Commit

Permalink
chore: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Dec 10, 2021
1 parent 7f2660c commit dfab78e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/plugins/es5.ts
@@ -1,3 +1,4 @@
import { PrettyError } from '../errors'
import { Plugin } from '../plugin'
import { localRequire } from '../utils'

Expand All @@ -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,
Expand Down

0 comments on commit dfab78e

Please sign in to comment.