Support import module from HTTP
zhmushan opened this issue · 2 comments
Describe the feature
Currently, UnoCSS uses JITI to read configuration files for better intelligence in VSCode. However, JITI cannot handle modules imported from HTTP, which results in UnoCSS not being able to provide intelligent suggestions when used with Deno.
related: unocss/unocss#3014
Example:
const jiti = require("jiti")(__filename);
jiti("./uno.config.ts"); // failed
// uno.config.ts
import presetUno from "https://esm.sh/@unocss/preset-uno@0.55.1";
export default {
presets: [presetUno()],
};
Additional information
- Would you be willing to help implement this feature?
Thanks for the idea! I love it and actually was tracking from mlly (unjs/mlly#1, for mlly.loadURL
) for same intention to use in jiti finally.
What is currently a blocker, is that jiti works on CommonJS system which cannot be async to support remote URLs like this. But we plan to introduce jiti.import(id): Promise<>
to unblock this!
Canceling the idea for now for jiti as there are security implications with this feature . Might make another lib for this.