Skip to content

Commit

Permalink
Prevent duplicate Babel object spread helpers. (#35136)
Browse files Browse the repository at this point in the history
* Prevent duplicate Babel object spread helpers.

With version 7.5.x of Babel, the object spread helper was updated to fix
some issues.

When we upgraded Babel to 7.5.5, it started trying to use the new helper
to perform object spreads. This would have been fine, since the relevant
package (transform-runtime) was part of the upgrade, but Babel
sadly assumes that its version is older, instead of auto-detecting.

This change explicitly indicates which version of the transform-runtime
we're using, fixing the issue. It unfortunately adds extra maintenance
overhead to Babel upgrades, but the Babel authors are considering adding
the aforemention auto-detection, at which point we could remove the
explicit definition.

See babel/babel#10261

* Add note to changelog.

* Add issue comment to Babel config too.
  • Loading branch information
sgomes authored and getdave committed Aug 12, 2019
1 parent e2857e3 commit fbe25b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/calypso-build/CHANGELOG.md
@@ -1,3 +1,8 @@
# [Unreleased]

- Added transform-runtime versioning to babel/default.js
This will need to be kept up to date while https://github.com/babel/babel/issues/10261 is unresolved.

# 3.0.0

- Switch to `@wordpress/dependency-extraction-webpack-plugin` from
Expand Down
3 changes: 3 additions & 0 deletions packages/calypso-build/babel/default.js
Expand Up @@ -22,6 +22,9 @@ module.exports = () => ( {
helpers: true,
regenerator: false,
useESModules: false,
// Needed so that helpers aren't duplicated.
// This will need to be kept up to date while https://github.com/babel/babel/issues/10261 is unresolved.
version: '7.5.5',
},
],
],
Expand Down

0 comments on commit fbe25b3

Please sign in to comment.