-
Notifications
You must be signed in to change notification settings - Fork 77
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
Pass the filename option to compiler #74
Pass the filename option to compiler #74
Conversation
@sodatea Would you mind take a look? |
Is there anything I could help to move this forward? |
What's the usage of it? |
If it's for the purpose mentioned in this issue vuejs/vue-loader#1603 |
IMO this is not related to vuejs/vue-loader#1603 (because my attention here is not to parse script/style), I want to do something like below:
but you will find that it doesn't work, the |
Do you have a reproduction repository? |
Could possibly be a bug in |
Here is the repro: https://github.com/NE-SmallTown/vue-compiler-options-bug-repro , sorry have no time to dig into the src code of vue-loder |
It's a bug in Next time please raise an issue before creating a PR because it could be an XY Problem (See also https://coolshell.cn/articles/10804.html for the Chinese version) |
Thanks for your response, but from my personal perspective, this is not a XY problem because this PR is not trying to fix the bug(but yes, you can "fix" it with this PR), its purpose is to make the |
What else use cases could this feature resolve? |
For example, I want to generate some Identities based on the filename, BTW, there is no secure/privacy problem because
I think it could because I test it locally and after that I create this PR, you can check it from this line, the |
Thanks for the note. I'm still struggling to find good use cases for this option. |
@znck any thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this PR because:
- no explicit objections from team members in near 3 weeks;
- it is purely additive;
- it provides a workaround for a bug that might not be resolved very soon in vue-loader;
Further actionable items:
- Need to address the new
filename
field invue-template-compiler
type definitions; - Need to provide similar functionalities in the new
compiler-sfc
package in Vue 3.
(Another reason I'm OK with this PR is that even if the current design later prove suboptimal, it'll be replaced by compiler-sfc
in Vue 3 anyway so we can do the experiment in this package)
Hey @NE-SmallTown, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚 |
Thanks.
Did you mean the
Don't know this before, seems it's a "TODO" package, at least for Another work I can imagine is to update the dependency version in vue-loader |
Yeah, not a follow up, just backlog. |
Ideally, the type definition in the |
Pass the filename option to compiler, so the compiler can get and pass it down in some cases like
transformNode/preTransformNode/postTransformNode