Skip to content

Fixes #1968 handling of default export reassignment cases#1975

Merged
lukastaegert merged 1 commit intomasterfrom
default-reassignment-deshadowing
Feb 19, 2018
Merged

Fixes #1968 handling of default export reassignment cases#1975
lukastaegert merged 1 commit intomasterfrom
default-reassignment-deshadowing

Conversation

@guybedford
Copy link
Contributor

The default reassignment case requires some exceptions in the code to be handled properly. Ideally we should treat the traced variable of the default as the expression statement of the default itself, as it seems like this inconsistency with the conceptual model is causing these exception cases, but I understand it was used to ensure tracing can get the most sensible variable name in the output which makes sense.

The hardest part of cracking this was coming up with just the right chunking scenario to replicate it, but it should be cracked now.

This is quite an important fix as the commonjs plugin outputs this pattern so it would be affecting many users testing out the code splitting with commonjs currently.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Very nice!

}

assert.deepEqual(actualFiles, expectedFiles);
assert.deepEqual(Object.keys(actualFiles), Object.keys(expectedFiles));
Copy link
Member

Choose a reason for hiding this comment

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

To my knowledge, there is no guaranteed order for Object.keys. Together with the check below, wouldn't it be enough to check that both have the same length?

Copy link

Choose a reason for hiding this comment

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

I believe Object.keys is indeed spec'd to enumerate keys in the order they were added. I believe this was an ES6 addition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes object order can be relied on fine, and it's a nicer error message to get a file listing diff than a numeric diff error.

Copy link
Member

Choose a reason for hiding this comment

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

In that case, I stand corrected. Sounds like fixturify also has a defined order so no problem here i guess.

Copy link

Choose a reason for hiding this comment

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

Hi Lukas. So sorry to bother - I know it's Sunday, but is there any chance this will be seeing the light of day soon? I'm eager to continue testing out Rollup's new code splitting 😁

Copy link
Member

Choose a reason for hiding this comment

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

And sorry for not getting back to you but I was out hiking yesterday 😉I'm on it now!

Copy link

Choose a reason for hiding this comment

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

Goodness please don't aplogize 🙃

Hope the hike was good - I'll look forward to getting back in there whenever this gets published 😬

Copy link
Member

Choose a reason for hiding this comment

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

As in—now 😁

Copy link

Choose a reason for hiding this comment

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

Woot! Thanks a ton!

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.

3 participants