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

Compatibility issue with PNPM package manager in 2.10.0 #758

Closed
drochgenius opened this issue Jul 20, 2022 · 7 comments
Closed

Compatibility issue with PNPM package manager in 2.10.0 #758

drochgenius opened this issue Jul 20, 2022 · 7 comments
Labels
info-needed Issue requires more information from poster

Comments

@drochgenius
Copy link

We are using pnpm package manager in our monorepo, in which we have many Visual Studio Code extensions.

Up until version 2.10.0, we were able to build the plugins with the --yarn option, but from version 2.10.0 it complains the yarn.lock is not available due to this change: d68e2f7.

Without the --yarn option, the plugins do not build in the monorepo context.

Could you please explain why this change was made, and advise how we could adapt our codebase?

Thanks

@joaomoreno
Copy link
Member

@drochgenius PNPM support is pending: #421, we never implemented it.

Looking at d68e2f7, the only conclusion I can draw is that using --yarn in a workspace without yarn.lock was simply a way not to do any dependency analysis whatsoever. While this (kind of) worked for you, it wasn't intended behavior. d68e2f7 is still a correct change. Very likely you've been shipping your extension with dev dependencies.

In your workspace, where do node_modules live? Do you have a repo I can look at?

@joaomoreno joaomoreno added the info-needed Issue requires more information from poster label Jul 21, 2022
@drochgenius
Copy link
Author

Thanks @joaomoreno for your response.

In out monorepo, the node_modules is at the root, that is 2 levels above the vscode plugin.

/node_modules/
/plugins/my-vs-code-plugin/

We switched from yarn to pnpm about 6 months ago, and it's been a very positive change for us, so I'm really looking forward tovsce supporting pnpm.

In the meantime, we have fixed the version to vsce@2.9.3 and continue using the --yarn option.

Regards

@joaomoreno
Copy link
Member

Just curious... when you run vsce ls do any node modules appear in that list?

@drochgenius
Copy link
Author

drochgenius commented Jul 22, 2022

I must to apply the --yarn flag, or else vsce ls outputs a bunch of missing package errors.
Now when I do run this command: pnpm exec vsce ls --yarn, I don't see any node modules in the list.
I just see a list of files that are local to my VS Code extension.

This is with vsce@2.9.3

@joaomoreno
Copy link
Member

joaomoreno commented Jul 22, 2022

So your extension doesn't really depend on any node modules to work, correct? If so, you should not be using --yarn at all... you should be using --no-dependencies: this will skip dependency analysis altogether. Can you try?

@drochgenius
Copy link
Author

Thanks @joaomoreno ,

Yes it works perfectly if I use the --no-dependencies flag instead of --yarn with vsce@2.10.0.
Indeed, I don't have external dependencies because I first bundle the extension using webpack, so when I reach the packaging step with vsce all my external dependencies are already resolved in the bundle.

I now understand I was not using vsce correctly for my setup.
Thanks very much for your help, I think this issue can now be closed.

@melMass
Copy link

melMass commented Oct 18, 2022

Just to clarify because I spent way too much time on this matter 😅:

Both vsce package and publish have a bundle step (not entirely sure by what it's powered or how it decides things), if, like IMHO you should, you handle bundling deps as part of your build process append --no-dependencies.

AFAIK @drochgenius your workflow was actually right, since I'm pretty sure you are handling deps bundling as part of your monorepo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants