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

Failed to import - @testing-library/react and lz-string #248

Closed
KyleJune opened this issue Jan 9, 2022 · 3 comments
Closed

Failed to import - @testing-library/react and lz-string #248

KyleJune opened this issue Jan 9, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@KyleJune
Copy link

KyleJune commented Jan 9, 2022

Failing module

This module is used for testing react components.

export {
  fireEvent,
  render,
  waitFor,
} from "https://esm.sh/@testing-library/react@12.1.2?target=deno&pin=v61";

Error message

After running deno run --config=deno.json test_deps.ts I get this:

error: Uncaught SyntaxError: The requested module '/v61/lz-string@1.4.4/deno/lz-string.js' does not provide an export named 'compressToEncodedURIComponent'
    at <anonymous> (https://cdn.esm.sh/v61/@testing-library/dom@8.11.1/deno/dom.js:2:670)

Additional info

  • esm.sh version: v61
  • Deno version: 1.17.2

I checked https://cdn.esm.sh/v61/lz-string@1.4.4/deno/lz-string.js and compressToEncodedURIComponent appears to be in it.

@KyleJune
Copy link
Author

It looks like the issue might be that lz-string is exporting default but not exporting the values like it is expected to. I'm able to lz-string by doing the following and lzString has compressToEncodedURIComponent on it.

import lzString from "https://esm.sh/lz-string@1.4.4?target=deno&pin=v61";

If I import * as lzString, the only key on lzString is default.

@KyleJune KyleJune changed the title Failed to import - @testing-library/react Failed to import - @testing-library/react and lz-string Jan 10, 2022
@KyleJune
Copy link
Author

I checked the source for @testing-library/dom, it looks like it expects lz-string to be imported in the way it is being imported in the source code.

https://github.com/testing-library/dom-testing-library/blob/066a41f80e9a6d3c0d248a3ed915c1c52501cf4b/src/screen.ts

Based on that, I think the issue is with lz-string exports being broken on esm.sh

@ije
Copy link
Member

ije commented Jan 10, 2022

thanks for the details! i will look into it

@ije ije closed this as completed in 8750753 Jan 11, 2022
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

2 participants