Skip to content

build(server-renderer): Add ESM as a build target #4209

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 1 commit into from
Jul 29, 2021

Conversation

Igloczek
Copy link
Contributor

@Igloczek Igloczek commented Jul 28, 2021

Scope of changes:
Add ESM as a build target for @vue/server-renderer

Reasoning:
I'm trying to fix Vue compatibility with Astro, which is build on top of Snowpack, so build tool that doesn't like non-ESM sources, and that causes issues with code duplication and breaking solutions based on being singletons, like currentRenderingInstance, that leads to errors while trying to render nested components.

Exposing this package as ESM is probably the simplest way to solve that problem, and from what I see some changes in this area was already made, for example ee4cbae, so hope it's inline with the vision.

@yyx990803 yyx990803 merged commit 1e3d468 into vuejs:master Jul 29, 2021
@Igloczek Igloczek deleted the esm-server-renderer branch July 29, 2021 15:05
@yyx990803
Copy link
Member

Hmm, I realized this alone probably isn't enough since @vue/server-renderer depends on @vue/compiler-ssr which is currently cjs-only.

@yyx990803
Copy link
Member

Oh I see the original issue is about duplicated Vue runtime so I guess leaving @vue/compiler-ssr as-is should be fine.

@Igloczek
Copy link
Contributor Author

From what I tested locally, it works with just this one in ESM, since the ssrUtils was the main problem, so unless there is some singleton-wannabe stuff in @vue/compiler-ssr, we should be fine.

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.

🐛 BUG: Vue components cannot be nested
2 participants