Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Potential issue with Webpack 5 and Yarn 2 #130

Closed
SomethingSexy opened this issue May 10, 2021 · 5 comments
Closed

Potential issue with Webpack 5 and Yarn 2 #130

SomethingSexy opened this issue May 10, 2021 · 5 comments

Comments

@SomethingSexy
Copy link

Setting up a single-spa test with Webpack 5, Yarn 2, and SWC. One of the issues I am getting is:

resolve as module
  request is not managed by the pnpapi
    single-spa-layout tried to access single-spa, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
    Required package: single-spa (via "single-spa")
    Required by: single-spa-layout@npm:1.5.1 (via /.../.yarn/cache/single-spa-layout-npm-1.5.1-fd1fdaa0f4-2aec253fcf.zip/node_modules/single-spa-layout/dist/esm/)

It looks like that is is complaining because single-spa-layout references single-spa but it isn't included in the package.json dependencies.

Is there a reason that it isn't included in single-spa-layout as a dependency?

@joeldenning
Copy link
Member

joeldenning commented May 13, 2021

The reason it's not listed as a dependency is to try to avoid duplicate instances of single-spa, as that results in problems. However, it should at the very least be a peerDependency, and maybe we could put "single-spa": "*" as a dependency to try to avoid a separate version used for single-spa-layout versus single-spa. I'll try that.

@joeldenning
Copy link
Member

Created #131 to resolve this

@SomethingSexy
Copy link
Author

@joeldenning that would be great, thanks! I forked the project and tested adding it at a minimum as a dependency as that at least allowed me to proceed with yarn 2. From my understanding adding it as peerDependency should work as well.

@joeldenning
Copy link
Member

Peer dependencies are so nuanced in their behavior across npm, pnpm, and yarn versions that I think the dependency is the best approach.

@joeldenning
Copy link
Member

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants