Skip to content

React native metro code target #28

@kastriotkastrati

Description

@kastriotkastrati

Describe the bug

Hello, so I'm configuring eas update in one of my apps in react-native where I'm encountering a problem.

[expo-cli] SyntaxError: node_modules\tinybase\lib\indexes.js: Unexpected token: operator (?) in file node_modules\tinybase\lib\indexes.js at 224:11
[expo-cli] Error: Unexpected token: operator (?) in file node_modules\tinybase\lib\indexes.js at 224:11
[expo-cli]     at minifyCode (--path--\node_modules\metro-transform-worker\src\index.js:101:13)
[expo-cli]     at transformJS (--path--\node_modules\metro-transform-worker\src\index.js:319:28)
[expo-cli]     at transformJSWithBabel (--path--\node_modules\metro-transform-worker\src\index.js:410:16)
[expo-cli]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[expo-cli]     at async Object.transform (--path--\node_modules\metro-transform-worker\src\index.js:571:12)

It seems that the transpiling target for tinybase is too high for metro which makes metro fail when it encounters new syntax like optional chaining etc.

It would be nice if the target was set to something that includes these features.

I have been debugging the problem for a while and it appears to me that adding this would help:

https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining.

I patched tinybase from node_modules with yarn by importing things from "lib/debug" and literally replacing lib/debug/*.js with the babel ie9 transpiled versions of those files and it all works, but it would be nice to have this from the package as others will probably encounter this problem in the future too.

Thank you

Your Example Website or App

No stackblitz for react-native

Steps to Reproduce the Bug or Issue

.

Expected behavior

.

Screenshots or Videos

No response

Platform

  • OS: [Windows]
  • Tinybase Version: [1.3.2]

Additional context

No response

Metadata

Metadata

Labels

enhancementNew feature or requestplease verifyCould you see if this is better now?

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions