Skip to content

Commit

Permalink
use @swc/core instead of the built-in babel form jiti
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Mar 14, 2023
1 parent e1bc353 commit f1614c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cli/build/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { lilconfig } from 'lilconfig'
import loadPlugins from 'postcss-load-config/src/plugins' // Little bit scary, looking at private/internal API
import loadOptions from 'postcss-load-config/src/options' // Little bit scary, looking at private/internal API
import jitiFactory from 'jiti'
import { transform } from '@swc/core'

import tailwind from '../../processTailwindFeatures'
import { loadAutoprefixer, loadCssNano, loadPostcss, loadPostcssImport } from './deps'
Expand All @@ -22,7 +23,8 @@ import log from '../../util/log'

let jiti = null
function lazyJiti() {
return jiti ?? (jiti = jitiFactory(__filename, { interopDefault: true }))
// @ts-expect-error SWC's transform function should be compatible
return jiti ?? (jiti = jitiFactory(__filename, { interopDefault: true, transform }))
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/oxide/cli/build/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { lilconfig } from 'lilconfig'
import loadPlugins from 'postcss-load-config/src/plugins' // Little bit scary, looking at private/internal API
import loadOptions from 'postcss-load-config/src/options' // Little bit scary, looking at private/internal API
import jitiFactory from 'jiti'
import { transform } from '@swc/core'

import tailwind from '../../../processTailwindFeatures'
import { loadPostcss, loadPostcssImport, lightningcss } from './deps'
Expand All @@ -20,7 +21,8 @@ import log from '../../../util/log'

let jiti: ReturnType<typeof jitiFactory> | null = null
function lazyJiti() {
return jiti ?? (jiti = jitiFactory(__filename, { interopDefault: true }))
// @ts-expect-error SWC's transform function should be compatible
return jiti ?? (jiti = jitiFactory(__filename, { interopDefault: true, transform }))
}

/**
Expand Down

0 comments on commit f1614c8

Please sign in to comment.