Skip to content

fix: transform/parse ts files and bundle using imports #447

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

Merged
merged 38 commits into from
Mar 17, 2025

Conversation

BobbieGoede
Copy link
Member

@BobbieGoede BobbieGoede commented Mar 14, 2025

Sorry for the big PR 🙏

I don't have a full understanding of the code base yet, with these changes the virtual bundling of messages to make use of file imports instead of directly transforming/compiling the resources files and combining the results. Now it should rely more on the vite/webpack/rspack functionality to transform the imported files.

I have changed the JS generator to also transform ts to js before parsing and transforming, I tried using oxc transform and parser but that would require additional changes for browser environments. This now uses babel for the transformation which is slower but should work as expected.

Projects using webpack/rspack still need to configure the necessary loaders for typescript in case they want to use ts files for locales.

The additions I made to the generator probably break proper source mapping, at least I have a feeling that it does 🤔

Resolves #266
Related #297
Related #228 (possibly resolves, have not tried)
Replaces #434
Replaces #446

@BobbieGoede BobbieGoede self-assigned this Mar 14, 2025
@BobbieGoede
Copy link
Member Author

This PR includes the changes from #446 and replaces #434

@BobbieGoede BobbieGoede changed the title fix: transform/parse ts files and bundle using imports [DRAFT] fix: transform/parse ts files and bundle using imports Mar 15, 2025
@BobbieGoede
Copy link
Member Author

BobbieGoede commented Mar 15, 2025

TODO

  • Exclude dynamic resources from virtual bundle (maybe need to warn instead of error?)
  • Research source mapping - check if still correct somehow

@BobbieGoede BobbieGoede changed the title [DRAFT] fix: transform/parse ts files and bundle using imports fix: transform/parse ts files and bundle using imports Mar 16, 2025
@BobbieGoede BobbieGoede requested a review from kazupon March 16, 2025 16:17
@BobbieGoede
Copy link
Member Author

@kazupon
These changes cover multiple things, I can split it up into smaller PRs if preferred 🙏

Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 😍
Thank you so much!
LTGM!

@kazupon kazupon merged commit 0b603d2 into main Mar 17, 2025
22 checks passed
@kazupon kazupon deleted the fix/support-ts-files-and-imports branch March 17, 2025 02:55
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

Successfully merging this pull request may close these issues.

TS files are not loaded (@intlify/unplugin-vue-i18n/messages)
2 participants