[polymer-build] #3402 resolveBareSpecifiers must be a Program #3404
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.
Babel's life cycle appears to make the following combination not possible with the current configuration of polymer's build process.
"moduleResolution": "node"
"transformModulesToAmd": true
"bundle": false,
What ends up happening now:
ast
for AMD compilation and/or ES5 syntax in the Program level callbackbabel-plugin-bare-specifiers
resolveBareSpecifiers
export because it is running in aCallExpression
which fires laterCallExpression
seeks out things marked 'Import' but because the compiling has already happened, it can't find everythingThis change fixes this by..
This shifts it to process at the Program level and traverse the path to execute
CallExpression
's. This should ensure that the timing is correct so that the Objects can be resolved to their correct node_modules / relative location, prior to the ES5 / AMD transformations processing the tree into text.Gains via this PR
Outstanding issues
#3403 is most likely related to this but I haven't been able to see what the issue is as to why this wouldn't overlap.