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

Prevent circular deps from causing a stack overflow in HMR runtime #2660

Merged
merged 3 commits into from
Feb 25, 2019

Conversation

rhurstdialpad
Copy link
Contributor

@rhurstdialpad rhurstdialpad commented Feb 21, 2019

↪️ Pull Request

This PR prevents a stack overflow when updating files that have circular dependencies. This issue occurs when HMR tries to reload dependencies and gets stuck following the loop. The fix is achieved by adding a set that contains each of the asset ID updated in the same HMR update event. This set is used to keep track of what has been updated and skips loading the same asset more than once.

Fixes #1192

@RobertWHurst
Copy link
Contributor

@DeMoorJasper @devongovett This is a pretty small fix. What do you guys think?

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Feb 21, 2019

Some kind of test would be good although at first sight the code looks good.
I also worry about using Set as it's not fully supported on IE (although this PR doesn't rely on behaviour that would break in IE afaik, not sure if we should use it)

@ksafranski
Copy link
Contributor

Confirmed this fixes an issue my team is having with maximum call stack errors on hmr reload. Tested on multiple browsers. Any word on how soon this might merge?

@DeMoorJasper
Copy link
Member

A test would def help in getting this merged, merging and updates are slow atm due to our attention being divided between updating Parcel 1 and building parcel 2

Sent with GitHawk

@mischnic
Copy link
Member

I have added a test and pushed to your branch, @rhurstdialpad I hope you don't mind.

@devongovett devongovett merged commit 8afacc3 into parcel-bundler:master Feb 25, 2019
@rhurstdialpad
Copy link
Contributor Author

rhurstdialpad commented Feb 25, 2019

@mischnic No problem at all. Thanks for adding the test. Stoked that has landed. 🍻

@JasCodes
Copy link

Any timeframes on next release?

@aMarCruz
Copy link

aMarCruz commented Mar 1, 2019

About to go back to webpack but I found this commit and now parcel w/ typescript works like a charm. Thanks @rhurstdialpad !!!

@RobertWHurst
Copy link
Contributor

@aMarCruz Not a problem, happy to help. I love Parcel.

@frother
Copy link

frother commented Mar 5, 2019

@aMarCruz How did you go about applying this patch? There doesn't seem to be a new version released. Thanks @RobertWHurst for the fix!!!

@aMarCruz
Copy link

aMarCruz commented Mar 5, 2019

@frother ,
Clone the repo and generate the package:

git clone https://github.com/parcel-bundler/parcel.git
cd parcel/packages/core/parcel-bundler
yarn && yarn build
npm pack

Move the generated "parcel-bundler-1.11.0.tgz" file to some folder in your app root and install it from there (for example, in a folder <app-root>.local-pkgs/):

// point the package.json dependency to the local package:

devDependencies: {
  "parcel-bundler": "./.local-pkgs/parcel-bundler-1.11.0.tgz",
}

then...

yarn

Done.

I hope I have not forgotten something.

BTW: "merging and updates are slow atm due to our attention being divided between updating Parcel 1 and building parcel 2" ...this words remind me of Windows, when the urgency of launching new features was more important than solving the bugs.

@JasCodes
Copy link

JasCodes commented Mar 5, 2019

@aMarCruz I actually build it for myself, but custom fonts were not working. You getting same kinna bug?

@aMarCruz
Copy link

aMarCruz commented Mar 5, 2019

@Jas99 , I don't use custom fonts.

@frother
Copy link

frother commented Mar 5, 2019

@aMarCruz Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

still has a circular dependencies bug
9 participants