framework
framework copied to clipboard
custom builtins
Sketch at #928. The main thing missing is the equivalent of getImplicitInputImports, getImplicitDownloads, etc. Also, I’d rather have this live inside the config file, but I think it’s harder to express the builtins as code if we do that?
Without trying to implement it (so I'm probably missing why it's difficult), I imagined you could say this in a config file:
const confetti = () => import("npm:canvas-confetti").then((confetti) => confetti.default);
export default {
builtins: {confetti},
...
}
Or, adding imports and downloads as keys:
const confetti = {
module: () => import("npm:canvas-confetti").then((confetti) => confetti.default),
imports: … ,
downloads: …
};
export default {
builtins: {confetti},
...
}
Try it in our config and you’ll see why. The config is server-side code, so we don’t want to use it to define client-side code.