You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my minimal React Native setup with Vite and React Native Web, I integrated Gluestack v2 along with the AlertDialog component, which includes the @legendapp/motion dependency. However, I encountered the following error: The compilation was successful, but the console showed this error log:
SyntaxError: The requested module '/node_modules/.vite/deps/@legendapp_motion.js?v=5af80577' does not provide an export named 'AnimatePresence' (at index.tsx:12:18)
After an extensive debugging session, I found that this issue is not related to React Native, Vite, or Gluestack. The problem is that your code is being parsed as CommonJS, which isn't compatible with my setup. The root cause lies in your package.json, which doesn't fully conform to the Node.js documentation. When using the exports property, the main, module, and types fields are ignored. You need to include them as require, import, and types entries within exports.
In my minimal React Native setup with Vite and React Native Web, I integrated Gluestack v2 along with the AlertDialog component, which includes the
@legendapp/motion
dependency. However, I encountered the following error: The compilation was successful, but the console showed this error log:SyntaxError: The requested module '/node_modules/.vite/deps/@legendapp_motion.js?v=5af80577' does not provide an export named 'AnimatePresence' (at index.tsx:12:18)
After an extensive debugging session, I found that this issue is not related to React Native, Vite, or Gluestack. The problem is that your code is being parsed as CommonJS, which isn't compatible with my setup. The root cause lies in your
package.json
, which doesn't fully conform to the Node.js documentation. When using theexports
property, themain
,module
, andtypes
fields are ignored. You need to include them asrequire
,import
, andtypes
entries withinexports
.Here's the correct structure:
You can either keep the old entries for Node <= 10 or remove them entirely.
I’ll be creating a PR for this, and I would appreciate it if you could review and approve it.
The text was updated successfully, but these errors were encountered: