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

WCC dropping query params when loading module URLs #158

Closed
thescientist13 opened this issue Apr 10, 2024 · 0 comments · Fixed by #159
Closed

WCC dropping query params when loading module URLs #158

thescientist13 opened this issue Apr 10, 2024 · 0 comments · Fixed by #159
Assignees
Labels
0.13.0 bug Something isn't working
Milestone

Comments

@thescientist13
Copy link
Member

Summary

Currently, if you have a module URL that you are passing into something like renderFromHTML, e.g.

const { html } = await renderFromHTML(`
  <html>
    <head>
      <title>WCC</title>
    </head>
    <body>
      <wcc-header></wcc-header>
      <h1>Home Page</h1>
      <wcc-footer></wcc-footer>
    </body>
  </html>
`,
[
  new URL('./src/components/footer.js?foo=bar', import.meta.url),
  new URL('./src/components/header.js?foo=bar', import.meta.url)
]);

the query params will be "dropped" which can interfere with downstream projects doing any sort of bundling / transforms / processing of these files and potentially relying on these query params, like with custom loaders.

Details

This looks to be an "over-correction" in support of CJS support as part of https://github.com/ProjectEvergreen/wcc/pull/67/files#r902061804

const { pathname } = elementURL;
const element = customElements.get(tagName) ?? (await import(pathname)).default;
const dataLoader = (await import(pathname)).getData;

At minimum we should be able to use href and still get all the compat we need

const { href } = elementURL;
const element = customElements.get(tagName) ?? (await import(href)).default;
const dataLoader = (await import(href)).getData;

But with #134 we can just pass the whole elementURL instead

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

Successfully merging a pull request may close this issue.

1 participant