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

Bug: error when loading the esm-browser version of the library #2261

Open
bertBruynooghe opened this issue Nov 28, 2023 · 3 comments
Open

Bug: error when loading the esm-browser version of the library #2261

bertBruynooghe opened this issue Nov 28, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@bertBruynooghe
Copy link

Description

Error during loading: Right side of assignment cannot be destructured in https://unpkg.com/@vue/[email protected]/dist/vue-test-utils.esm-browser.js line 13606

To Reproduce
https://stackblitz.com/edit/web-platform-szhdln?file=styles.css

Expected behavior
Should at least load.

@bertBruynooghe bertBruynooghe added the bug Something isn't working label Nov 28, 2023
@cexbrayat
Copy link
Member

cexbrayat commented Nov 28, 2023

Hi @bertBruynooghe

thanks for the repro

It looks like this is because ssrUtils is not available in the esm-browser version of Vue and VTU uses it for renderToString (the helper function to test the SSR rendering of a component).

We should probably "guard" this renderToString function to avoid shipping it in the esm-browser version of VTU, as Vue does:
https://github.com/vuejs/core/blob/2cece5ba1b9b254cface23096d17ed0e1910467d/packages/runtime-core/src/index.ts#L351

Do you think you could look into and open a PR? We would gladly review it and merge it.

@bertBruynooghe
Copy link
Author

We will pick this up somewhere this week. Thanks for the quick reply and the code example!

@Sandbagger
Copy link

Hello @cexbrayat,

Thank you once again for your quick response.

I'm picking this up today the PR (currently in WIP) can be found here #2264

In the Vue example that you provided, there is SSR variable. Can I assume that this will be available to Test Utils or should I determine the environment by some other means i.e. check for window?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants