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

Fix Windows Portable App mode #974

Merged
merged 1 commit into from Sep 27, 2016
Merged

Fix Windows Portable App mode #974

merged 1 commit into from Sep 27, 2016

Conversation

feross
Copy link
Member

@feross feross commented Sep 27, 2016

Fixes: #971

This is a perfect example of putting too many statements into a
try-catch block. My bad. I was trying to keep the code simple, but it
bit us here.

This happens because we were using IS_PRODUCTION, but the order of the
consts at the top are:

const IS_PORTABLE = isPortable()
const IS_PRODUCTION = isProduction()

So we're inside of isPortable() and referring to IS_PRODUCTION before
it's defined. This should have thrown an exception, but it was caught by
the try-catch block.

Also, even after moving it out of the try-catch block, it still doesn't throw
an exception because we're transforming to ES5, so the consts are
changed to vars.

Also, standard should have caught this, but there's this bug standard/standard#636 that is preventing
us from enabling the use-before-define rule. Will hopefully be fixed
soon.

Basically, a perfect storm.

Fixes: #971

This is a perfect example of putting too many statements into a
try-catch block. My bad. I was trying to keep the code simple, but it
bit us here.

This happens because we were using IS_PRODUCTION, but the order of the
consts at the top are:

const IS_PORTABLE = isPortable()
const IS_PRODUCTION = isProduction()

So we're inside of isPortable() and referring to IS_PRODUCTION before
it's defined. This should have thrown an exception, since const does
not allow use-before-define, but we're transforming to ES5 with Babel.

Also, standard could have caught this, but we can't enable the
use-before-define rule until this bug is fixed:
standard/standard#636

Basically, a perfect storm.
Copy link
Contributor

@mathiasvr mathiasvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this was "interesting"! 😄

@feross feross merged commit d2eb87e into master Sep 27, 2016
@lock lock bot locked as resolved and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WTD uses OS' Users folers If "Portable Settings" folder is existed
2 participants