Skip to content
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

feat: import cost - show the size of the imported package inline vscode #64

Open
SohelIslamImran opened this issue Jul 14, 2024 · 7 comments

Comments

@SohelIslamImran
Copy link

SohelIslamImran commented Jul 14, 2024

This package is already great! But I think we can make it even greater, if we can show the size of the imported package inline in vscode. There is already a vscode extension called Import Cost which does that using webpack. I think if we can show the import size like now in the browser, then we should also be able to fork the Import Cost repo and add this package and create a new vscode extension to show inline file import size. It would be nice if someone takes some time and does that. It will be really mind-blowing and great to know the cost of and import while typing/importing.

image

@SohelIslamImran
Copy link
Author

SohelIslamImran commented Jul 14, 2024

image

@byCedric
Copy link
Member

Hi @SohelIslamImran! We have access to the full Metro graph, meaning we should have that data available already. We only need to iterate over all files related to the module and count the module.size (which is in bytes).

With that, we can render the information in various places.

@SohelIslamImran
Copy link
Author

Sounds great! It would be nice if someone build a vscode extension like Import Cost

@SohelIslamImran
Copy link
Author

@byCedric Maybe I couldn't describe it properly. But it isn't my question that if we can get module size info and use that. I know we can. I'm just asking someone to create a vscode extension like Import Cost with this. Thanks

@chriszs
Copy link

chriszs commented Jul 16, 2024

It seems like part of the point of Atlas is a dogfood technology demo of an Expo app, but I do wonder about whether other forms should be explored, or whether that's consistent with the Atlas product strategy. In particular, you could imagine this outputting an image after a build and replying on a PR if the size increases like Codecov. You could imagine integration with Expo Tools VS Code extension, or another one. You could imagine this being integrated into EAS, or adding a log line on the terminal in the CLI when the bundle or an import size passes a threshold. I think the convenience of having this information glanceable where you work shouldn't be underestimated. Extending this to visualize other metrics is another possible direction, but it'd really depend on motivation and where Expo sees this going. To be clear, I think it's super useful now!

@SohelIslamImran
Copy link
Author

I build an extension 😁 https://github.com/SohelIslamImran/expo-import-cost
Now I need to publish

image

@SohelIslamImran
Copy link
Author

I can't publish🥲 because VSCode Marketplace requires Azure, and I tried to signup but failed. They require card information, but it is saying that there is something wrong with my card info. Maybe my country is not supported!

Hey @byCedric, can I create a PR with https://github.com/SohelIslamImran/expo-import-cost as a package in this repo? Then you can publish and also improve more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants