Skip to content

Commit

Permalink
Update internal jsx loader
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 17, 2022
1 parent 7cf6c9f commit 7506633
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions script/jsx-loader.js
@@ -1,7 +1,7 @@
import path from 'path'
import {promises as fs} from 'node:fs'
import path from 'node:path'
import {URL, fileURLToPath} from 'node:url'
import {transformSync} from 'esbuild'
import {transform, transformSync} from 'esbuild'

const {load, getFormat, transformSource} = createLoader()

Expand All @@ -26,8 +26,9 @@ export function createLoader() {

const fp = fileURLToPath(new URL(url))
const value = await fs.readFile(fp)
const {code, warnings} = transformSync(String(value), {
sourcefile: fileURLToPath(url),

const {code, warnings} = await transform(String(value), {
sourcefile: fp,
sourcemap: 'both',
loader: 'jsx',
target: 'esnext',
Expand All @@ -41,11 +42,10 @@ export function createLoader() {
}
}

// V8 on Erbium.
/* c8 ignore next 2 */
return {format: 'module', source: code}
}

// Pre version 17.
/**
* @param {string} url
* @param {unknown} context
Expand Down

1 comment on commit 7506633

@vercel
Copy link

@vercel vercel bot commented on 7506633 Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

mdx – ./

mdx-mdx.vercel.app
mdx-git-main-mdx.vercel.app
v2.mdxjs.com
mdxjs.com

Please sign in to comment.