tradle / rn-nodeify

hack to allow react-native projects to use node core modules, and npm modules that use them
MIT License
614 stars 114 forks source link

Cannot build IOS bundle in production mode #134

Closed fifa-master closed 11 months ago

fifa-master commented 11 months ago

error shim.js: .../shim.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "StringLiteral". TypeError: .../shim.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "StringLiteral" { "name": "...", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest", "postinstall": "rn-nodeify --install 'crypto,process,stream,events' --hack" }, "dependencies": { "@gorhom/bottom-sheet": "^4.4.7", "@metamask/sdk": "^0.5.6", "@react-native-async-storage/async-storage": "^1.19.1", "@react-native-clipboard/clipboard": "^1.11.2", "@react-native-community/blur": "^4.3.2", "@react-navigation/bottom-tabs": "^6.5.8", "@react-navigation/drawer": "^6.6.3", "@react-navigation/native": "^6.1.7", "@react-navigation/native-stack": "^6.9.13", "@reduxjs/toolkit": "^1.9.5", "axios": "^1.4.0", "crypto": "^1.0.1", "date-fns": "^2.30.0", "events": "^3.3.0", "formik": "^2.4.3", "process": "^0.11.10", "i18next": "^23.4.4", "react": "18.2.0", "react-i18next": "^13.1.2", "react-native": "0.72.3", "react-native-background-timer": "^2.4.1", "react-native-blob-util": "^0.19.1", "react-native-circular-progress": "^1.3.9", "react-native-crypto": "^2.2.0", "react-native-document-picker": "^9.0.1", "react-native-dotenv": "^3.4.9", "react-native-drawer": "^2.5.1", "react-native-gesture-handler": "^2.12.0", "react-native-image-picker": "^5.6.0", "react-native-pdf": "^6.7.1", "react-native-randombytes": "^3.6.1", "react-native-reanimated": "^3.3.0", "react-native-safe-area-context": "^4.7.1", "react-native-screens": "^3.22.1", "react-native-svg": "^13.10.0", "react-native-video": "^5.2.1", "react-redux": "^8.1.2", "stream": "^0.0.2", "stream-browserify": "^1.0.0", "ua-parser-js": "^1.0.35", "yup": "^1.2.0", "readable-stream": "1.0.33" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/eslint-config": "^0.72.2", "@react-native/metro-config": "^0.72.9", "@tsconfig/react-native": "^3.0.0", "@types/react": "^18.0.24", "@types/react-redux": "^7.1.25", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", "eslint": "^8.19.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "0.76.7", "prettier": "^2.4.1", "react-test-renderer": "18.2.0", "rn-nodeify": "^10.3.0", "typescript": "4.8.4" }, "engines": { "node": ">=16" }, "react-native": { "crypto": "react-native-crypto", "_stream_transform": "readable-stream/transform", "_stream_readable": "readable-stream/readable", "_stream_writable": "readable-stream/writable", "_stream_duplex": "readable-stream/duplex", "_stream_passthrough": "readable-stream/passthrough", "stream": "stream-browserify" }, "browser": { "crypto": "react-native-crypto", "_stream_transform": "readable-stream/transform", "_stream_readable": "readable-stream/readable", "_stream_writable": "readable-stream/writable", "_stream_duplex": "readable-stream/duplex", "_stream_passthrough": "readable-stream/passthrough", "stream": "stream-browserify" } } Generated shim.js: `if (typeof dirname === 'undefined') global.dirname = '/'; if (typeof filename === 'undefined') global.filename = ''; if (typeof process === 'undefined') { global.process = require('process'); } else { const bProcess = require('process'); for (var p in bProcess) { if (!(p in process)) { process[p] = bProcess[p]; } } }

process.browser = false; if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;

// global.location = global.location || { port: 80 } const isDev = typeof DEV === 'boolean' && DEV; process.env['NODE_ENV'] = isDev ? 'development' : 'production'; if (typeof localStorage !== 'undefined') { localStorage.debug = isDev ? '*' : ''; }

// If using the crypto shim, uncomment the following line to ensure // crypto is loaded first, so it can populate global.crypto // require('crypto'); `

fifa-master commented 11 months ago

Closed in https://github.com/tradle/rn-nodeify/issues/116