unjs/jiti

native esm loader with `jiti.import`

pi0 opened this issue · 4 comments

pi0 commented

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)

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.

pi0 commented

@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.

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

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

pi0 commented

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.