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

Cannot package with vsce if using a linked package #581

Closed
chrisvrose opened this issue Jun 12, 2021 · 6 comments
Closed

Cannot package with vsce if using a linked package #581

chrisvrose opened this issue Jun 12, 2021 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality

Comments

@chrisvrose
Copy link

My project uses a module linked from another location.
Doing either vsce package or vsce ls throws a

path should be a `path.relative()`d string, but got "../otherProject/node_modules/@types/chai/index.d.ts"

(The other repository uses chai for testing)

.vscodeignore has been set up to ignore node_modules for the current project, which is where the symlink to otherProject is (as I said, linked repository).

Once unlinked, I can package the repository and the resulting extension works fine (Because really I want to package the webpack-ed files, and I don't need the rest)

Of course, this isn't really an optimal solution as unlinking, compiling then linking is not really nice.

@chrisvrose
Copy link
Author

This seems to be because the ignore module does not like locations starting with ../ for ignoring (which is a legitimate path.relative output but it is not accepted)

@joaomoreno
Copy link
Member

Do you expect the linking to simply be resolved during packaging?

@joaomoreno joaomoreno self-assigned this Jun 14, 2021
@joaomoreno joaomoreno added the feature-request Request for new features or functionality label Jun 14, 2021
@chrisvrose
Copy link
Author

chrisvrose commented Jun 14, 2021

Do you expect the linking to simply be resolved during packaging?

The linked module is in node_modules, which is part of my .vscodeignore, so I'm expecting it to be ignored. Instead I end up with the above error.

.vscodeignore contents:

.vscode/**
.vscode-test/**
node_modules/**

client/**
server/**
webpack.config.js
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts

EDIT: Add:
This can be reproduced by npm link <any package> and then trying to package (as long as that package you're trying to include is not under the current repo), even if node_modules is under .vscodeignore

@Vtec234
Copy link

Vtec234 commented Jun 25, 2021

You might have some luck using 1.91.0, before #418 was merged. In that version vsce still tries to pull in the entire contents of the linked folder (node_modules and so on), but you can stop that by putting ../** in .vscodeignore.

More generally, including everything except .vscodeignore by default seems to cause a lot of trouble -- I would suggest revisiting #12.

@chrisvrose
Copy link
Author

chrisvrose commented Jun 25, 2021

You might have some luck using 1.91.0, before #418 was merged. In that version vsce still tries to pull in the entire contents of the linked folder (node_modules and so on), but you can stop that by putting ../** in .vscodeignore.

More generally, including everything except .vscodeignore by default seems to cause a lot of trouble -- I would suggest revisiting #12.

Thank you! I reverted back to v1.91.0 and it seems to work perfectly with your mentioned change.
Its a better workaround than unlinking and packaging then linking again.

Edit: With the revert to minimatch in v1.95, the above method works as well.

@joaomoreno
Copy link
Member

#308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants