Gatsby: Use site's browserlist settings for determining if the safari10 option should be set in tensorjs

Created on 18 Dec 2018  路  3Comments  路  Source: gatsbyjs/gatsby

We want this instead of just setting it true.

https://github.com/gatsbyjs/gatsby/pull/10536

Most helpful comment

Please check issue attached to the PR - https://github.com/gatsbyjs/gatsby/issues/10513 for some context. We were doing checks on bundle sizes for this and there is no difference in actual output for default starter (like actual content is the same, not only bundle size).

the mangle.safari10 options targets specific scenario:

safari10 (default false) -- Pass true to work around the Safari 10 loop iterator bug "Cannot declare a let variable twice"

mangling is renaming variables to those single characters names. So this is very rare when this would actually increase bundle size - and if it does it would be by few bytes.

We also don't use browserlist to cover IE11 currently (just do it by default). We definitely can look into using browserlist for configuring terser options, but it would be some breaking changes I think and also require us to maintain the browserlist -> terserOptions "mapping".

I do think as long as there are no changes in bundle sizes and bundles works providing support for safari10 by default is good idea

All 3 comments

We'll want to use this utility.

I think an approach like this will work just fine. I'm not sure if there's a better way to query if a browser is included in that threshold, but that should be a reasonable solution.

Please check issue attached to the PR - https://github.com/gatsbyjs/gatsby/issues/10513 for some context. We were doing checks on bundle sizes for this and there is no difference in actual output for default starter (like actual content is the same, not only bundle size).

the mangle.safari10 options targets specific scenario:

safari10 (default false) -- Pass true to work around the Safari 10 loop iterator bug "Cannot declare a let variable twice"

mangling is renaming variables to those single characters names. So this is very rare when this would actually increase bundle size - and if it does it would be by few bytes.

We also don't use browserlist to cover IE11 currently (just do it by default). We definitely can look into using browserlist for configuring terser options, but it would be some breaking changes I think and also require us to maintain the browserlist -> terserOptions "mapping".

I do think as long as there are no changes in bundle sizes and bundles works providing support for safari10 by default is good idea

Ah cool 馃憤 as long as that's all the option is doing then yeah, turning it on by default seems fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

ferMartz picture ferMartz  路  3Comments

brandonmp picture brandonmp  路  3Comments

jimfilippou picture jimfilippou  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments