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

fix(unplugin-vue-i18n): ts files load #434

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

daguanren21
Copy link

fix: TS files are not loaded (@intlify/unplugin-vue-i18n/messages)

@daguanren21
Copy link
Author

node版本太低对应的corepack太低导致此,需要corepack最新版本就能解决pnpm签名问题

@kazupon
Copy link
Member

kazupon commented Feb 23, 2025

Could you fix the CI fails? 🙏

@daguanren21
Copy link
Author

Could you fix the CI fails? 🙏
OK

@@ -10,7 +10,7 @@ import type { MessageCompilerContext } from '@intlify/core-base'
fixture: '@intlify/unplugin-vue-i18n/messages'
}
].forEach(({ testcase, input, fixture }) => {
test(testcase, async () => {
test.skip(testcase, async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Why would you skip this test case? 🤔

Copy link
Author

Choose a reason for hiding this comment

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

I follow this file packages\unplugin-vue-i18n\test\webpack\bundle-import.test.ts to fix

Copy link
Author

Choose a reason for hiding this comment

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

I don't quite understand the test cases here, so I found that there is a problem with skip handling under webpack. I think there is a problem, but I don't know how to solve it

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, This is so weird...
I made a test PR to see if I could reproduce this phenomenon, but I couldn't.
#440

Could you re-send your PR from latest commits please?

Copy link
Author

Choose a reason for hiding this comment

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

Resubmit

@kazupon
Copy link
Member

kazupon commented Mar 5, 2025

Hi!
CI has still errors.
Please check it, and We hope it should be fixed with you.

@BobbieGoede
Copy link
Member

We likely need to remove the types from typescript files before passing it to the generateJavaScript generator. The files in the examples directories probably work because they don't contain any types.

Perhaps we need something like sucrase to strip the types or we need to look into oxc-parser for parsing but that would likely be quite involved.

@daguanren21
Copy link
Author

Since these two files cannot be parsed into the desired AST using the generateJavascript method, they are temporarily unsupported. I will look into how to handle these cases in the future.

Hi! CI has still errors. Please check it, and We hope it should be fixed with you.

@BobbieGoede
Copy link
Member

Since these two files cannot be parsed into the desired AST using the generateJavascript method, they are temporarily unsupported. I will look into how to handle these cases in the future.

It would be better to keep the test fixtures as they originally were, and prevent loading .ts files for now, only adding support for .js instead 🤔

The changes in it its current state might suggest to users that we support loading .ts files here, but it would break once typescript features are used.

@daguanren21
Copy link
Author

Since these two files cannot be parsed into the desired AST using the generateJavascript method, they are temporarily unsupported. I will look into how to handle these cases in the future.由于这两个文件无法使用generateJavascript方法解析为所需的AST,因此暂时不支持。我将在将来研究如何处理这些情况。

It would be better to keep the test fixtures as they originally were, and prevent loading .ts files for now, only adding support for .js instead 🤔最好保留原来的测试装置,并暂时阻止加载.ts文件,而只添加对.js的支持 🤔

The changes in it its current state might suggest to users that we support loading .ts files here, but it would break once typescript features are used.其当前状态的变化可能向用户表明我们支持在此处加载.ts文件,但一旦使用 typescript 功能,它就会中断。

Most projects nowadays are TypeScript-based, so removing TypeScript doesn’t seem appropriate. I will consider how to resolve these two cases.

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

Successfully merging this pull request may close these issues.

3 participants