-
Notifications
You must be signed in to change notification settings - Fork 409
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
Do not remove the pkg directory #1110
Conversation
A recent commit ensured that the pkg directory was removed as the first step of creating it. Unfortunately, this causes a problem for tools such as webpack when watching the pkg directory. In the case of webpack, it is unable to recover its watching and so any watch server must be restarted, consuming the developer's time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. Well, sorry about. Thanks for mentioning the discussion. It's nice to know that it was at least discussed about even if the incorrect choice was made.
@drager Could you merge when you get a chance?
Are these test failures mine? I simply removed a line... I couldn't successfully run |
Would it be possible to follow up on the above as wasmpack is broken for us. Thanks. |
I think this wasn't this PRs fault. Will merge and investigate why it fails. Thanks for the PR! |
Thank you, and thanks for your efforts here too! |
This change - while necessary to fix interaction with e.g. the webpack dev server - causes a new problem: Now that wasm-pack doesn't clear the output folder, it will pick up the |
The change here restores behaviour to what it was, so is the problem you describe really a new issue? |
Yes. Deleting the output folder was introduced along with the changes that implement the package.json generation, so prior to that, the problem I describe did not exist. |
Perhaps the solution is to just remove the package.json? I don’t know, but I’m thinking a new issue should be raised. Wdyt? |
Simply removing package.json is what I'm doing now: main--@13369d2 And it does resolve the problem for me. |
Do you know if this upsets webpack again though as per #1110 (comment)? |
At least in my setup, this makes webpack even happier than before. Before, I was (on Windows) just launching an instance of cmd in the pkg directory to prevent it from getting deleted - this still made webpack sad because it would see files getting deleted, rebuild (with an error) and then build again once the files are back. Now that the files are overwritten directly, it only builds once (and also much faster, presumably because caching works better). My webpack doesn't care about the package.json at all. |
Thanks for following up. Fingers crossed then! |
Not sure I follow correctly but will this PR when released solve your problem @main-- ? |
Just opened an issue (#1118) regarding this and arrived at the same conclusion as @main-- during my investigation. Another option would be to rewrite write_package_json() so that it can distinguish between a package.json from wasm-bindgen and a package.json already processed by wasm-pack. I have no idea if and how that would work, though. |
A recent commit (d79e721) ensured that the
pkg
directory was removed as the first step of attempting to create it. Unfortunately, this causes a problem for webpack when watching thepkg
directory. Webpack is unable to recover its watching and so any watch server must be restarted, which is a blocker when using it.Please note that there was some debate about whether to remove the
pkg
directory. It is unclear to me what the actual benefits of it are, and whether this PR re-introduces some other problem. However, wasmpack appears to have existed as per the behaviour of this PR for a few years.This PR reverses the change made in the above commit and fixes #1099.