Skip to content

upgrade to babel 6#9775

Merged
erwinmombay merged 16 commits intoampproject:masterfrom
erwinmombay:babel-6
Sep 13, 2017
Merged

upgrade to babel 6#9775
erwinmombay merged 16 commits intoampproject:masterfrom
erwinmombay:babel-6

Conversation

@erwinmombay
Copy link
Copy Markdown
Member

Closes #9695

@erwinmombay erwinmombay requested review from jridgewell and rsimha June 7, 2017 18:06
@erwinmombay erwinmombay force-pushed the babel-6 branch 2 times, most recently from cacebf2 to 26926aa Compare June 7, 2017 18:08
.babelrc Outdated
["env", {
"loose": true,
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jridgewell please correct this if needed

cc @cramforce

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jridgewell im guessing you want this dynamic based on the original issue, depending on if we're in test or dev mode etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, CI would get this string (safari >= 9, though is what I think we support), and in dev testing we would use the latest Chrome

Copy link
Copy Markdown
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

This is awesome that it worked so seamlessly!

}
_parseError.prototype = Error;

throw new _parseError(str, hash);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's this change for?

Copy link
Copy Markdown
Member Author

@erwinmombay erwinmombay Jun 7, 2017

Choose a reason for hiding this comment

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

babel6 was erroring out on some label statements in the generated jison file (because of use strict + label usage), i tried upgrading jison and regenerated the files but it was still failing and had to add the "transform-remove-strict-mode" plugin to get it to work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Odd, that line shouldn't throw. 😞

Copy link
Copy Markdown
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

Please log the built file sizes (both build and dist). Doesn't need to be part of the PR, just a comment is fine.

gulpfile.js Outdated
}

var browsers = [
process.env.TRAVIS ? "safari >= 9" : "Last 1 Chrome versions"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs the "last 2 versions" in Travis.

@cramforce
Copy link
Copy Markdown
Member

Nice!

@lannka
Copy link
Copy Markdown
Contributor

lannka commented Aug 22, 2017

I ended up into this issue when last time trying to do babel6: babel/babel#4480
custom-element cries illegal constructor bla blaa

I suppose this has been fixed by one of the plugin?

@@ -1,98 +1,98 @@
max | min | gzip | file
--- | --- | --- | ---
290 kB | 31.63 kB | 12.49 kB | alp.js / alp.max.js
Copy link
Copy Markdown
Member Author

@erwinmombay erwinmombay Sep 11, 2017

Choose a reason for hiding this comment

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

@jridgewell seems to be some hefty increases on the babel sizes, lmk if theres any option that i missed turning on/off that would have done this.

it doesnt really affect the files we serve built from CC.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is because of babel-polyfill which is MASSIVE


const port = new WindowPortEmulator(
this.win, viewerOrigin);
window, viewerOrigin);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@chenshay can you double check that this is ok

"prepend-v0": "gulp prepend-global --prod node_modules/AMP_CONFIG.json --local --target dist/v0.js && gulp prepend-global --prod node_modules/AMP_CONFIG.json --local --target dist.3p/current-min/f.js"
},
"dependencies": {
"babel-polyfill": "6.26.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hopefully this isn't needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

unfortunately it is needed for regenerator-runtime

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think regenerator only needs some symbol polyfills, which should be much smaller than the entire babel-polyfill.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jridgewell my expectation was babel-preset-env would have figured that out and added the polyfill but all the issues i found told me to include babel-polyfill. is there a specific package i can include that will allow me to remove babel-polyfill?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can either drop regenerator (loose generator support in Safari 9), or dig through the regenerator runtime code to see what we need.

Copy link
Copy Markdown
Member Author

@erwinmombay erwinmombay Sep 13, 2017

Choose a reason for hiding this comment

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

@jridgewell got it. do you mind if i create a separate issue/pr for that and merge this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure.

@@ -1,98 +1,98 @@
max | min | gzip | file
--- | --- | --- | ---
290 kB | 31.63 kB | 12.49 kB | alp.js / alp.max.js
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is because of babel-polyfill which is MASSIVE

@ampprojectbot ampprojectbot added this to the Pending Triage milestone Sep 12, 2017
@erwinmombay
Copy link
Copy Markdown
Member Author

follow up issue here #11291

@erwinmombay erwinmombay merged commit 712cff9 into ampproject:master Sep 13, 2017
@rsimha
Copy link
Copy Markdown
Contributor

rsimha commented Sep 15, 2017

@erwinmombay @danielrozenberg all yarn dependencies were removed in #11279. Looks like this PR wasn't rebased properly, and has re-added yarn.lock. It'll need to be removed again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants