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

[RFC] fix: Generate TypeScript templete when using Router #5697

Closed
wants to merge 1 commit into from
Closed

[RFC] fix: Generate TypeScript templete when using Router #5697

wants to merge 1 commit into from

Conversation

TETRA2000
Copy link

@TETRA2000 TETRA2000 commented Jul 19, 2020

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

References #5695

I found that @vue/cli-plugin-typescript won't generate typescript vue templete while using @vue/cli-plugin-router.
Its seems overridden by router's template.
(Please take a look at the issue for detail.)

I made small patch to modify plugin order before their execution.

This is just a PoC.
I don't think this is the best way to solve the problem.

I'd like to ask you to give me some advice.
Maybe it's better to add some methods to GeneratorAPI to manage execution order.


FYI:

I tried to solve this by adding options to sortObject in Creator.resolvePlugins like this.

  // { id: options } => [{ id, apply, options }]
  async resolvePlugins (rawPlugins, pkg) {
    // ensure cli-service is invoked first
    rawPlugins = sortObject(rawPlugins, ['@vue/cli-service', '@vue/cli-plugin-router', '@vue/cli-plugin-typescript'], true)

But somehow it didn't work as I intended. It generated same JS template.

I suspect that there is another dependencies on execution order in generator functions.

@sodatea
Copy link
Member

sodatea commented Jul 19, 2020

FYI it's been fixed as part of PR #5637
df93f46 (#5637)

It's certainly not the best way to solve the problem but the plugin ordering API is not a priority at the moment so I think we'll live with the hack for a while.

@TETRA2000
Copy link
Author

@sodatea Thank you for notifying me about that.
And I also found that my PR will generate wrong App.vue (which doesn't use router-link )

I'm gonna close this one.

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.

None yet

2 participants