-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Roll forward CC upgrade with fixes (#18552) #18609
Roll forward CC upgrade with fixes (#18552) #18609
Conversation
// checkVars: Demote "variable foo is undeclared" errors. | ||
// moduleLoad: Demote "module not found" errors to ignore missing files | ||
// in type declarations in the swg.js bundle. | ||
jscomp_warning: ['checkVars', 'moduleLoad'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we need this for both compile
and check-type
tasks? was wondering if we could make it conditional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be consistent between both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@choumx ideally. i just remembered the scenario you ran into originally with multi-pass, where the compilation worked but check-types failed. was that more an inconsistency with another option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few minor comments that likely are worth addressing in a followup.
The only item with a slightly higher concern is transpiling node_modules
, but the number of items AMP uses from node_modules
is small.
Thanks for the reviews! |
const newSource = [ | ||
wrapperOpen, reactDates, file.substr(firstLineBreak + 1), | ||
].join('\n'); | ||
fs.writeFileSync(destFilePath, newSource, 'utf8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erwinmombay @cvializ FYI this is how I'm solving it for multi-pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@choumx did this actually work for single pass? i dont think single pass reaches this code path from the testing ive been doing on master. just double checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it. This technique is certainly part of the solution for single-pass. We still need to either (1) add externs or (2) change all invocations into react, moment, etc. in AMP code to either use bracket notation.
Tested the normal push build steps locally (full compile and test etc.) and everything looks good after some final fixes. Merging! 🤞 |
* Revert "Revert CC upgrade. (ampproject#18600)" This reverts commit 6fd3044. * Remove node_modules/ from js_module_root. * Fix swg.js again. * Increase bundle size cap to 82.2. * Inject react-dates bundle post-compile instead of importing in code. * Typecast react-dates imports in amp-date-picker. * Bump bundle-size. * Restore --js_module_root for 1-pass. * Remove obsolete 'erwinmHack'.
* Revert "Revert CC upgrade. (ampproject#18600)" This reverts commit 6fd3044. * Remove node_modules/ from js_module_root. * Fix swg.js again. * Increase bundle size cap to 82.2. * Inject react-dates bundle post-compile instead of importing in code. * Typecast react-dates imports in amp-date-picker. * Bump bundle-size. * Restore --js_module_root for 1-pass. * Remove obsolete 'erwinmHack'.
See #18552.
New changes:
node_modules/
path fromjs_module_root
option. It caused silent bundling failure with imports leaving undefined Closure module path vars e.g.module$path$to$foo
.swg.js
.react-dates
issue [1] by injecting it post-compile instead of a JSimport
inamp-date-picker.js
and removed obsolete "erwinmHack" export hack. :)amp-date-picker.js
.[1] CC v20171112 appears to DCE some of browserify's module loading boilerplate in
third_party/react-dates/bundle.js
. Specifically: