unjs / jiti

Runtime TypeScript and ESM support for Node.js
MIT License
1.91k stars 62 forks source link

feat: handle `data:` imports (non-native only) #299

Closed bohjak closed 2 months ago

bohjak commented 2 months ago

Resolves https://github.com/unjs/jiti/issues/207

Explicitly check for data: scheme and use native import to handle it.

bohjak commented 2 months ago

@pi0 I've added the data-uri fixture to the ignore lists for the native and bun tests. Breaks native, because it requires ESM. I haven't looked into how exactly bun imports work, but for some reason the require keyword works fine with data URLs, but import doesn't :shrug: