Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

feat(nuxt): support vue runtime compiler - #4762

Merged
danielroe merged 49 commits into
nuxt:mainfrom
huang-julien:feat/nuxt-ssr-runtime-template-compiler
Apr 6, 2023
Merged

danielroe merged 49 commits into
nuxt:mainfrom
huang-julien:feat/nuxt-ssr-runtime-template-compiler

Conversation

@huang-julien

@huang-julien huang-julien commented May 2, 2022 •

Copy link
Copy Markdown
Member

🔗 Linked issue

resolve nuxt/nuxt#13843

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR allow to use vue runtimeCompiler on both server and client side

  • add vue.runtimeCompiler boolean option to nuxt/schema
  • unmock vue 3 only when runtimeCompiler option is set to true when building and make vue runtime compiler available client side
  • with externalVue to true, force trace files used by generated code from the runtime compiler

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify

netlify Bot commented May 2, 2022 •

Copy link
Copy Markdown

✅ Deploy Preview for nuxt3-docs ready!

Name Link
🔨 Latest commit b404f6e
🔍 Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/632b6790a288710009537d25
😎 Deploy Preview https://deploy-preview-4762--nuxt3-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@danielroe danielroe added enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels May 3, 2022
@huang-julien
huang-julien force-pushed the feat/nuxt-ssr-runtime-template-compiler branch 2 times, most recently from e897d31 to 905b3b6 Compare May 3, 2022 10:10
@pi0

pi0 commented May 3, 2022

Copy link
Copy Markdown
Member

Hi @huang-julien and thanks for this PR! 💚 I think finally we can add an option to nitro if modification of commonJS plugin options is required.

I hope we can add runtime support with lighter dependencies. At least having @vue/devtools-api doesn't makes sense to me in the bundle for it.

(BTW: You don't need to merge into main on each commit. I will make once rebase before merge)

@huang-julien

Copy link
Copy Markdown
Member Author

Hi @huang-julien and thanks for this PR! 💚 I think finally we can add an option to nitro if modification of commonJS plugin options is required.

I hope we can add runtime support with lighter dependencies. At least having @vue/devtools-api doesn't makes sense to me in the bundle for it.

(BTW: You don't need to merge into main on each commit. I will make once rebase before merge)

Hi @pi0 👋 , yes i was thinking about a PR on Nitro to add the option for the commonjs plugin modification instead of just replacing it in the nuxt package. Do you want me to remove the @vue/devtool-api from the bundle through a commit ?

@huang-julien

Copy link
Copy Markdown
Member Author

linked PR - nitrojs/nitro#187
the feature will be refactored if the PR is accepted

Comment thread packages/nuxt/src/core/nitro.ts Resolved
Comment thread packages/nuxt/package.json Resolved
@huang-julien

Copy link
Copy Markdown
Member Author

@pi0 it should be ok now. here's a working example

@huang-julien
huang-julien requested a review from pi0 May 12, 2022 06:52
Comment thread packages/nuxt/src/core/nitro.ts Resolved
Comment thread packages/schema/src/config/build.ts Resolved
@huang-julien
huang-julien requested a review from pi0 May 12, 2022 10:38
@huang-julien
huang-julien force-pushed the feat/nuxt-ssr-runtime-template-compiler branch from 31535eb to 7095f92 Compare May 12, 2022 10:45
@huang-julien

huang-julien commented May 13, 2022 •

Copy link
Copy Markdown
Member Author

Client builds with runtime compiler now supports webpack and the runtimeCompiler option is now under the vue namespace in packages/schema/src/config/_app.ts

@tobiasdiez

Copy link
Copy Markdown
Contributor

What's the status of this PR? Would be awesome to use the runtime compiler soon!

@huang-julien

Copy link
Copy Markdown
Member Author

@tobiasdiez if you really need it now, this module can enable it

@huang-julien
huang-julien marked this pull request as draft July 21, 2022 20:42
@huang-julien

Copy link
Copy Markdown
Member Author

investigating nuxt/nuxt#13843

@huang-julien

Copy link
Copy Markdown
Member Author

fixed nuxt/nuxt#13843

@huang-julien
huang-julien marked this pull request as ready for review July 22, 2022 21:43
@atinux

atinux commented Jul 23, 2022

Copy link
Copy Markdown
Member

Thank you!

It would be nice to document this option somewhere since it is quite useful for CMS integrations using the template prop (see linked issue).

Also, is there a place where we can add a test case for this?

Comment thread packages/schema/src/config/build.ts Resolved
Comment thread packages/schema/src/config/build.ts Resolved
@huang-julien

huang-julien commented Jul 23, 2022 •

Copy link
Copy Markdown
Member Author

@atinux

Also, is there a place where we can add a test case for this?

Do you mean a stackblitz or an example ? I've tested the component with template defined in runtime in the playground here

@atinux

atinux commented Jul 25, 2022

Copy link
Copy Markdown
Member

I am thinking of a test case here: https://github.com/nuxt/framework/tree/main/test

Any guidance for the best place for it? @danielroe @pi0

@pi0

pi0 commented Jul 25, 2022

Copy link
Copy Markdown
Member

Testing requires making another fixture currently we only have one. We can add later.

I'm pending to locally test this PR. Some changes can be probably reduced for mocking and saving bundle size with option enabled.

In the meantime you can use nuxt-runtime-compiler module

@huang-julien
huang-julien marked this pull request as draft September 3, 2022 22:20
@huang-julien

huang-julien commented Mar 31, 2023 •

Copy link
Copy Markdown
Member Author

can't find why CI are failing 🤷‍♂️ I can't see logs while it does work locally. I'm not even sure if the issue comes from estree walker

@huang-julien
huang-julien marked this pull request as ready for review April 3, 2023 20:09
Comment thread packages/nuxt/src/core/nitro.ts Resolved
Comment thread packages/nuxt/src/core/nitro.ts Resolved
@autofix-troubleshooter

Copy link
Copy Markdown

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

@danielroe danielroe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good to me - I've tested on an external project as well, and all seems good. Very happy to iterate over v3.4 releases and then make stable in vue.runtimeCompiler in v3.5.

Thank you so much for your lengthy and good work on this ❤️

@danielroe danielroe changed the title feat(nuxt): support using vue runtimeCompiler on build feat(nuxt): support vue runtime compiler Apr 6, 2023
@danielroe
danielroe merged commit 3fc9a75 into nuxt:main Apr 6, 2023
@danielroe danielroe mentioned this pull request Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.x enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow using vue runtime compiler in built nuxt app

8 participants

Sponsor
SponsoredKunjungi sekarang
Promo