jiti icon indicating copy to clipboard operation
jiti copied to clipboard

native esm loader with `jiti.import`

Open pi0 opened this issue 3 years ago • 4 comments

In contexts where file extension is explicit .mjs or closest package.json has type: module we may use native ESM and for typescript, disable CommonJS transforms.

Blocker is, jiti is supposed to be used in a cjs context (require replacement). We probably need to implement a new function like jiti.import that returns Promise (compatible to be dynamic import replacement)

pi0 avatar May 27 '21 10:05 pi0

oh yeah, waiting this so much, cause vite-plugin-windicss uses jiti for loading configurations and thats why it cannot work with type: module sveltekit exclusively uses.

dioxine avatar Jun 05 '21 01:06 dioxine

@danielroe I've moved vite 3 related issue to #66. Supporting native esm loader (jiti.import) can probably wait until Node.js has it out of the flag.

pi0 avatar Jun 17 '22 08:06 pi0

Hi, Thanks for your effort! This project is very useful! 🥳

Uhhh, How to disable CommonJS transforms? Any workarounds are there?

dohooo avatar Jun 18 '22 15:06 dohooo

Hi. Just a quick update, i still plan to do this. In the meantime, are they are incomaptbile libraries with cjs transforms? Please mention them there might be faster fixes for them.

pi0 avatar May 03 '23 19:05 pi0