-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Wait for close event when writing bundles #4552
Conversation
Don't know why all tests timeout, it works locally |
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached Bundles
React HackerNews ✅
Timings
Cold Bundles
Cached BundlesNo bundle changes detected. AtlasKit Editor 🚨
Timings
Cold BundlesNo bundles found, this is probably a failed build... Cached BundlesNo bundles found, this is probably a failed build... Three.js x4 🚨
Timings
Cold BundlesNo bundles found, this is probably a failed build... Cached BundlesNo bundles found, this is probably a failed build... |
e0b4908
to
2c78d20
Compare
|
Can someone reproduce this? I have a feeling that this only happened on Node 13 and works with 14 and 12 (so without this PR) |
@mischnic I've been able to reproduce this very reliably on my Mac using Node 12.9. It did not emit the close event at all, this appeared to be due to it never getting destroyed, which I fixes by enabling autoDestroy. According to the NodeJS docs this is the default option though so I'm kind of confused why this was necessary at all. Anyway hope this does not have any side effects, tests seem to pass locally for me now. |
Somewhat related: I just got
I think we want diff --git packages/reporters/bundle-analyzer/src/BundleAnalyzerReporter.js packages/reporters/bundle-analyzer/src/BundleAnalyzerReporter.js
index df1d39e7..077f6537 100644
--- packages/reporters/bundle-analyzer/src/BundleAnalyzerReporter.js
+++ packages/reporters/bundle-analyzer/src/BundleAnalyzerReporter.js
@@ -22,7 +22,9 @@ export default new Reporter({
Array<Bundle>,
> = new DefaultMap(() => []);
for (let bundle of event.bundleGraph.getBundles()) {
- bundlesByTarget.get(bundle.target.name).push(bundle);
+ if (!bundle.isInline) {
+ bundlesByTarget.get(bundle.target.name).push(bundle);
+ }
}
let reportsDir = path.join(options.projectRoot, 'parcel-bundle-reports'); as well? |
@mischnic that's definitely supposed to exclude inline bundles, like the cli bundlereport does https://github.com/parcel-bundler/parcel/blob/v2/packages/reporters/cli/src/bundleReport.js#L27 |
With the change in parcel-bundler#4552 close can be called twice, therefore the second rename will fail. Only executing it once prevents it. Closes parcel-bundler#4614
With the change in parcel-bundler#4552 close can be called twice, therefore the second rename will fail. Only executing it once prevents it. Closes parcel-bundler#4614
↪️ Pull Request
I was getting "no such file or directory " when the bundle report was trying to read an bundle from the disk because the dist dir only contained 'index.js.68061.0.6'.
NodeFS#createWriteStream
does the atomic renaming onclose
, but thePackagerRunner
only waits forfinish
.parcel/packages/core/fs/src/NodeFS.js
Line 47 in 619cbaf
finish
is fired beforeclose
Test instructions
Run
rm -rf dist/*; parcel build index.js --no-cache --detailed-report
multiple times. Before, that would occasionally result in: