Roll forward CC upgrade with fixes (#18552)#18609
Roll forward CC upgrade with fixes (#18552)#18609dreamofabear merged 10 commits intoampproject:masterfrom
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.
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.
Shouldn't we be consistent between both?
There was a problem hiding this comment.
@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?
kristoferbaxter
left a comment
There was a problem hiding this comment.
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.
@erwinmombay @cvializ FYI this is how I'm solving it for multi-pass.
There was a problem hiding this comment.
@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.
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_rootoption. It caused silent bundling failure with imports leaving undefined Closure module path vars e.g.module$path$to$foo.swg.js.react-datesissue [1] by injecting it post-compile instead of a JSimportinamp-date-picker.jsand 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: