Handle undefined expressions in treeshaking - #2264
Merged
Merged
Conversation
Contributor
Author
|
This resolves #2223 as well. |
lukastaegert
approved these changes
Jun 16, 2018
lukastaegert
left a comment
Member
There was a problem hiding this comment.
Just some suggestions for the test. Looks good!
| console.log('no'); | ||
| if (z ? (console.log('a'), false) : (console.log('b'), false)) | ||
| console.log('yes'); | ||
| z = 1; |
Member
There was a problem hiding this comment.
I'm not too happy the comma expression logs. They sure prevent the ternary operators from being tree-shaken but in the light of what you want to test, I would rather have simple direct tests such as
if (x) console.log('no');
if (!x) console.log('yes');i.e. six simple test cases which are more readable and where it is easily clear what went wrong when the test turns red. It's also easy to overlook in your test that the second value in the comma expressions are not symmetric.
guybedford
force-pushed
the
undefined-expression-treeshake
branch
from
June 17, 2018 12:02
5e1dbca to
468b4d6
Compare
calebeby
referenced
this pull request
in Pigmice2733/scouting-frontend
Jun 21, 2018
This Pull Request updates dependency [rollup](https://github.com/rollup/rollup) from `v0.60.7` to `v0.61.1` <details> <summary>Release Notes</summary> ### [`v0.61.1`](https://github.com/rollup/rollup/blob/master/CHANGELOG.md#​0611) [Compare Source](rollup/rollup@v0.61.0...697f36d) *2018-06-21* * Do not try to deconflict "undefined" ([#​2291](`https://github.com/rollup/rollup/pull/2291`)) * Properly track values for loop interator declarations and reassigned namespaces, add smoke test ([#​2292](`https://github.com/rollup/rollup/pull/2292`)) --- ### [`v0.61.0`](https://github.com/rollup/rollup/blob/master/CHANGELOG.md#​0610) [Compare Source](rollup/rollup@v0.60.7...v0.61.0) *2018-06-20* * Declare file dependencies via transform plugin hooks ([#​2259](`https://github.com/rollup/rollup/pull/2259`)) * Handle undefined values when evaluating conditionals ([#​2264](`https://github.com/rollup/rollup/pull/2264`)) * Handle known undefined properties when evaluating conditionals ([#​2265](`https://github.com/rollup/rollup/pull/2265`)) * Access watch events via the plugin context ([#​2261](`https://github.com/rollup/rollup/pull/2261`)) * Add option to suppress `__esModule` flag in output ([#​2287](`https://github.com/rollup/rollup/pull/2287`)) * Fix issue when re-declaring variables, track reassignments in more cases ([#​2279](`https://github.com/rollup/rollup/pull/2279`)) * Add VSCode debug settings ([#​2276](`https://github.com/rollup/rollup/pull/2276`)) --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2223
This extends the
UNDEFINED_EXPRESSIONto return aundefinedliteral value which can be treeshaken.