Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Simpify babel config slightly (#2593)
Browse files Browse the repository at this point in the history
This moves preset-env plugins to be included as part of the preset-env
pass rather than separatly - which is now possible because we've dropped
decorator support.

This does produce some output changes in production builds - mostly
removing cases where class properties were needlessly initialize to
undefined.
  • Loading branch information
BPScott authored Mar 9, 2023
1 parent ce10bd6 commit 2f731db
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 14 deletions.
23 changes: 23 additions & 0 deletions .changeset/fair-dancers-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@shopify/browser': patch
'@shopify/graphql-persisted': patch
'@shopify/graphql-testing': patch
'graphql-typescript-definitions': patch
'@shopify/jest-dom-mocks': patch
'@shopify/logger': patch
'@shopify/performance': patch
'@shopify/react-async': patch
'@shopify/react-effect': patch
'@shopify/react-i18n': patch
'@shopify/react-network': patch
'@shopify/react-server': patch
'@shopify/react-shortcuts': patch
'@shopify/react-testing': patch
'@shopify/semaphore': patch
'@shopify/sewing-kit-koa': patch
'@shopify/statsd': patch
'@shopify/storybook-a11y-test': patch
'@shopify/web-worker': patch
---

Remove unneeded `void 0` class property initializations
32 changes: 18 additions & 14 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ module.exports = function (api) {
presets: [
[
'@babel/preset-env',
{bugfixes: true, useBuiltIns: 'entry', corejs: '3.0'},
{
bugfixes: true,
useBuiltIns: 'entry',
corejs: '3.0',
// Always include these transformations, as we want to maintain
// webpack v4 support for esnext builds until the next major release.
// These syntaxes are not supported in acorn v6 (used by webpack v4),
// so we must transpile them away if we want webpack v4 support
// See https://github.com/webpack/webpack/issues/10227
include: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
],
},
],
['@babel/preset-typescript'],
['@babel/preset-react', {development, useBuiltIns: true}],
],
plugins: [
// These plugins are handled by preset-env.
// But they aren't yet supported in webpack 4 because of missing support
// in acorn v6 (support is in acorn v7, which is used in webpack v5).
// So we want to always transpile this synax away
// See https://github.com/webpack/webpack/issues/10227
// Can be removed once we drop support for webpack v4
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
],
plugins: [],
assumptions: {
setPublicClassFields: true,
privateFieldsAsProperties: true,
Expand Down

0 comments on commit 2f731db

Please sign in to comment.