-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
dependenciesMeta:injected
breaks hmr
#4410
Comments
This will be fixed in v7 |
I guess we use copy-on-write on macos. So when you change the file, the injected file is not changed. Would a sync command help? You may try to set package-import-method to |
@zkochan thanks for fixing the path thing. As for the file not changed, tbh the sync command is not the solution. I mean you would expect this to work. I think for me thanks for looking into this |
@zkochan i have been testing 7 rc versions and the possiblity to drop |
@zkochan sorry to bump this but this is a big issue which is still happening with 7.0.0. files in a |
In v7 the file protocol always works as injected. For the old behavior of |
@zkochan I can't use link because users might be using yarn or npm |
This is the same way it works in Yarn. |
@zkochan sorry not sure i understand your point. |
Well, you said "I can't use link because users might be using yarn or npm" but as I said, the file: protocol works the same way in both pnpm v7 and Yarn. The link: protocol also works the same way in pnpm and Yarn. So you really only care about npm compatibility, not npm and Yarn compatibility. I don't get it why you allow your users to use random package managers in your repositories. You need to pick one package manager and commit its lockfile. With this "flexibility" you're just causing more work for yourself and nondeterminism. An option to make it work as in npm might be added. Though I don't see too much value in it. |
@zkochan we are an OSS project and we don't need nor want to force anyone to use one package manager or another. we all have our preferences. And npm (I would say sadly) is the default one for everyone on their computer. |
Hi there, even if package-import-method=hardlink the hmr and /build directory is not sync. macOS 13. file:../packA. link |
It might be that the build overwrites the files in the package. In that case, only some "sync" command would help. |
@zkochan the thing is that it was working with 6.x can't we get that back ? I mean using |
@zkochan I am sorry to bump this but it is really a pain for complex workspace. I use |
As I already said above, the I don't see enough value in this setting to make the code a lot more complex. I would rather change how the protocol works, which would be a breaking change. And not an easy change. I don't see demand for this change. You are making everyone's life harder by choosing to support any package manager in your repositories. Just pick one and commit its lockfile. If it won't be pnpm, fine.
A module.exports = {
hooks: {
readPackage (pkg) {
for (const [name, spec] of Object.entries(pkg.dependencies)) {
pkg.dependencies[name] = spec.replace('file:', 'link:');
}
return pkg
}
}
} It will only break on |
@zkochan i kind of understand your point. though you can't say choose a package manager and make everyone s life easier. if I choose pnpm a lot of users will complain. I can say that for sure as we already tried. I am trying to find an easy solution was which would.make everyone happy |
I don't get it. Do contributors to the project complain? Contributors to your repositories?
In pnpm v6 |
@zkochan yes many contributors do not want to use pnpm and stick to npm. I asked explicitly if I could force pnpm and they asked me not to do it. Thanks for the explanation about 6.x vs 7.x it is much clearer now. |
Maybe. I don't know |
Is there an update on this by any chance? I am hitting this case where I need to use the UPDATE - I think I found a workaround for this issue with Vite by combining the |
Update: We've proposed a |
I am on macos.
Here is my setup:
@nativescript-community/template-snippet
with dependencies like this:@nativescript-community/template-snippet
like this:The idea behind this is to have
@nativescript-community/ui-material-bottomnavigationbar
as a "direct" dependency in hoist mode in my app (which i need).It works in the sense that i do see
![Screenshot 2022-03-04 at 13 24 02](https://user-images.githubusercontent.com/655344/156764300-12fa7bbc-1b59-4db8-8baa-43619f37321c.png)
@nativescript-community/ui-material-bottomnavigationbar
in my app "node_modules"However HMR is broken for the file inside that package (
node_modules/@nativescript-community/ui-material-bottomnavigationbar
).I have realized that the file modified at this path is changed but the HMR only picks it up once i "open" or access that file.
wondering if it comes from the way injected are "linked"?
Also as shown in the screenshot the full absolute path is used for the injected module "path name". It is thus really long and could create issues like on Windows. Wouldn't it be best to use the relative path?
EDIT: if i use
touch
on the real path with all the ++ then HMR (webpack) also picks it up.The text was updated successfully, but these errors were encountered: