Skip to content

Commit

Permalink
Fix ESM loader for Node 16- and React 18
Browse files Browse the repository at this point in the history
Related-to: a778c57.
Related-to: mdx-js/mdx#1808.
  • Loading branch information
wooorm committed Mar 8, 2022
1 parent 41377ab commit cdfd61a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/integration/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,15 @@ export function createLoader(options = {}) {
}

const file = await process(new VFile({value, path: new URL(context.url)}))
let source = String(file)

if (fixRuntimeWithoutExportMap) {
source = String(file).replace(/\/jsx-runtime(?=["'])/g, '$&.js')
}

// V8 on Erbium.
/* c8 ignore next 2 */
return {source: String(file).replace(/\/jsx-runtime(?=["'])/g, '$&.js')}
return {source}
}
/* c8 ignore end */
}

0 comments on commit cdfd61a

Please sign in to comment.