-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract entrypoint options improvements #506
Comments
Alright, I have a proof of concept using Vite's runtime API to load entrypoints: #585
So this should cover all the issues people have reported. HOWEVER... it appears the vite runtime can't import CSS modules, which is kinda important. I've asked a question about it in the vite discord, so we'll se if I get a useful response. https://discord.com/channels/804011606160703521/1236142702785990677/1236142702785990677 |
Alright, it was an issue on my side. Just needed to start the vite server lol. So it's working now. I need to clean up my changes before opening a real PR. Probably won't get to it this weekend... we'll see. But I got everything working :) |
Last problem to address... Module side effects. Say you're using storage item in your content script: // utils/storage.ts
export const isXyzEnabled = storage.defineItem(...); // entrypoints/content.ts
import { isXyzEnabled } from '~/utils/storage';
export default defineContentScript({
// ...
async main() {
console.log(await isXyzEnabled.getValue());
}
}); In this example, So I have a decision to make. When importing entrypoints during the build to get their config, do I...
I think... I'm gonna go with option 1, and remove the main function. For performance reasons (importing less code as project grows) as well as avoiding weird edge cases around the node environment these files are loaded into (similar to what I'm currently doing with jiti). So I have to decide the best way to do that. Removing the main function should be simple... Use magicast or regex. To remove unused imports after that... I'm not sure how to do that. Regex again? Or use magicast to get the imports, and find/replace if they're used. Probably that. I'll just use magicast for everything if possible. |
Playing around a bit, removing unused imports isn't a simple task lol. Instead, I'm just going to remove |
Released v0.18.0 with an experimental flag to enable this feature. If you use PNPM, for some reason it requires setting |
This is an issue for addressing several issues with how entrypoints are imported to get their options.
import.meta.glob
doesn't work #635Will add to this list if other issues come up.
The text was updated successfully, but these errors were encountered: