module.exports = function (api) {
  api.cache(true);
  return {
    presets: [
      [
        'babel-preset-expo',
        {
          // babel-preset-expo disables the class-properties transform on web
          // (modern browsers support class fields natively), but WatermelonDB's
          // legacy decorators require class properties to be transformed AFTER
          // decorators. Disable the preset's own decorators transform and apply
          // both transforms here with the correct ordering.
          decorators: false,
        },
      ],
    ],
    plugins: [
      ['@babel/plugin-proposal-decorators', { legacy: true }],
      ['@babel/plugin-transform-class-properties', { loose: true }],
      ['@babel/plugin-transform-class-static-block', { loose: true }],
      ['@babel/plugin-transform-private-methods', { loose: true }],
      ['@babel/plugin-transform-private-property-in-object', { loose: true }],
    ],
  };
};
