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: namedExports won't work on version 3.x #3889

Open
1 task done
alcferreira opened this issue Mar 10, 2022 · 2 comments
Open
1 task done

🐛 BUG: namedExports won't work on version 3.x #3889

alcferreira opened this issue Mar 10, 2022 · 2 comments

Comments

@alcferreira
Copy link

Quick checklist

  • I am using the latest version of Snowpack and all plugins.

What package manager are you using?

yarn

What operating system are you using?

macOS

Describe the bug

I'm updating snowpack from version 2.18.2 to 3.8.8.

I fixed the breaking changes related to config name changes that we were expecting based on the upgrade guide, but after we keep getting this error message: Module "XXXX" has no exported member "default". Did you mean to use "import default from 'XXXX'" instead?.

On version 2.x this was fixed by using the namedExports option that is documented on the Common error details

I didn't find anything else related to this on the docs, did I miss something? Was there any other change on this behavior that perhaps was not documented?

Steps to reproduce

  1. have a project with namedImports and [email protected]
  2. update snowpack to v3.x and fix the errors related to the config name changes
  3. now the namedImports config won't work anymore

Link to minimal reproducible example (optional)

No response

@crapthings
Copy link

I have the same issue

@walletconnect.jsonrpc-utils.v1.0.0.js:3 Uncaught (in promise) SyntaxError: The requested module '/_snowpack/pkg/@walletconnect.environment.v1.0.0.js' does not provide an export named 'formatErrorMessage' (at @walletconnect.jsonrpc-utils.v1.0.0.js:3:10)

image

add namedExports doesn't help

@pc-erin
Copy link

pc-erin commented Apr 19, 2022

@crapthings Is this the same bug?
It seems like a bug in snowpack but I'm not sure it's related to the namedExports thing.

If you have a look at the @walletconnect/jsonrpc-utils package snowpack seems to mistakenly be thinking that all it's exports are being re-exported from @walletconnect/environment.

I think this is related to a nested re-export statement.

If you have a look here: https://unpkg.com/@walletconnect/[email protected]/dist/esm/index.js
The first 2 lines work fine. All the exports from ./constants and ./error are re-exported correctly, with parseConnectionError being the last export in the snowpack'ed version. After that ./env uses the line export * from "@walletconnect/environment"; and snowpack seems to convert that to

export { formatErrorMessage, formatJsonRpcError, formatJsonRpcRequest, formatJsonRpcResult, isHttpUrl, isJsonRpcError, isJsonRpcPayload, isJsonRpcRequest, isJsonRpcResponse, isJsonRpcResult, isJsonRpcValidationInvalid, isLocalhostUrl, isValidDefaultRoute, isValidLeadingWildcardRoute, isValidRoute, isValidTrailingWildcardRoute, isValidWildcardRoute, isWsUrl, payloadId } from '@walletconnect/environment';

simply assuming the rest of the exports are coming from @walletconnect/environment.

Not sure if this should be moved to a different issue.

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

No branches or pull requests

3 participants