Open 1wayticket opened 5 months ago
我也遇到这个问题了,直接taro init新的模板,什么都没做,直接编译就报错了
同样的问题, yarn dev:rn 可以执行 build就会报错
+1 是什么配置不兼容导致的吗?麻烦官方大大给指导一下 不胜感激 { "name": "myApp", "version": "1.0.0", "private": true, "description": "111", "templateInfo": { "name": "default", "typescript": false, "css": "Sass", "framework": "React" }, "scripts": { "build:weapp": "taro build --type weapp", "build:swan": "taro build --type swan", "build:alipay": "taro build --type alipay", "build:tt": "taro build --type tt", "build:h5": "taro build --type h5", "build:rn": "taro build --type rn", "build:qq": "taro build --type qq", "build:jd": "taro build --type jd", "build:quickapp": "taro build --type quickapp", "build:harmony-hybrid": "taro build --type harmony-hybrid", "dev:weapp": "npm run build:weapp -- --watch", "dev:swan": "npm run build:swan -- --watch", "dev:alipay": "npm run build:alipay -- --watch", "dev:tt": "npm run build:tt -- --watch", "dev:h5": "npm run build:h5 -- --watch", "dev:rn": "npm run build:rn -- --watch", "dev:qq": "npm run build:qq -- --watch", "dev:jd": "npm run build:jd -- --watch", "dev:quickapp": "npm run build:quickapp -- --watch", "dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch", "test": "jest" }, "browserslist": [ "defaults and fully supports es6-module", "maintained node versions" ], "author": "", "dependencies": { "@babel/runtime": "^7.20.0", "@reduxjs/toolkit": "^1.9.0", "@tarojs/components": "4.0.0-canary.9", "@tarojs/components-rn": "4.0.0-canary.9", "@tarojs/helper": "4.0.0-canary.9", "@tarojs/plugin-framework-react": "4.0.0-canary.9", "@tarojs/plugin-http": "^3.6.24", "@tarojs/plugin-platform-alipay": "4.0.0-canary.9", "@tarojs/plugin-platform-h5": "4.0.0-canary.9", "@tarojs/plugin-platform-harmony-hybrid": "4.0.0-canary.9", "@tarojs/plugin-platform-jd": "4.0.0-canary.9", "@tarojs/plugin-platform-qq": "4.0.0-canary.9", "@tarojs/plugin-platform-swan": "4.0.0-canary.9", "@tarojs/plugin-platform-tt": "4.0.0-canary.9", "@tarojs/plugin-platform-weapp": "4.0.0-canary.9", "@tarojs/react": "4.0.0-canary.9", "@tarojs/redux": "^2.2.10", "@tarojs/rn-runner": "4.0.0-canary.9", "@tarojs/rn-supporter": "4.0.0-canary.9", "@tarojs/runtime": "4.0.0-canary.9", "@tarojs/runtime-rn": "4.0.0-canary.9", "@tarojs/shared": "4.0.0-canary.9", "@tarojs/taro": "4.0.0-canary.9", "@tarojs/taro-rn": "4.0.0-canary.9", "@wuba/react-native-echarts": "^1.3.0", "ali-oss": "^6.20.0", "axios": "^1.6.7", "classnames": "^2.5.1", "crypto-js": "^4.2.0", "dayjs": "^1.11.10", "echarts": "^5.5.0", "expo": "~50.0.2", "js-base64": "^3.7.7", "linear-gradient-taro": "^1.0.1", "md5": "^2.3.0", "prop-types": "^15.8.1", "proptypes": "^1.1.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-native": "^0.73.1", "react-native-calendars": "^1.1304.1", "react-native-device-info": "^10.13.1", "react-native-gesture-handler": "^2.14.0", "react-native-pager-view": "~6.0.1", "react-native-qrcode-svg": "^6.3.0", "react-native-splash-screen": "^3.3.0", "react-native-svg": "~14.1.0", "react-native-view-shot": "^3.8.0", "react-redux": "^9.1.0", "redux-persist": "^6.0.0", "taro-code": "^4.0.1", "taro-react-echarts": "^1.2.2", "taro-ui": "^3.3.0" }, "devDependencies": { "@babel/core": "^7.24.9", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5", "@tarojs/cli": "4.0.0-canary.9", "@tarojs/taro-loader": "4.0.0-canary.9", "@tarojs/test-utils-react": "^0.1.1", "@tarojs/webpack5-runner": "4.0.0-canary.9", "@types/jest": "^29.3.1", "@types/node": "^18.15.11", "@types/webpack-env": "^1.13.6", "ahooks": "^3.7.10", "babel-preset-taro": "4.0.0-canary.9", "eslint": "^8.12.0", "eslint-config-prettier": "^9.1.0", "eslint-config-taro": "4.0.0-canary.9", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.12.0", "eslint-plugin-react": "^7.8.2", "eslint-plugin-react-hooks": "^4.2.0", "jest": "^29.3.1", "jest-environment-jsdom": "^29.5.0", "postcss": "^8.4.18", "prettier": "^2.8.8", "react-refresh": "^0.11.0", "stylelint": "^14.4.0", "taro-iconfont-cli": "^3.3.0", "ts-node": "^10.9.1", "webpack": "5.78.0", "webpack-bundle-analyzer": "^4.10.1", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/eslint-config": "^0.73.1", "@react-native/metro-config": "^0.73.2", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "install-peerdeps": "^3.0.3", "pod-install": "^0.1.38", "react-test-renderer": "18.2.0", "typescript": "5.0.4" } }
+1 是什么配置不兼容导致的吗?麻烦官方大大给指导一下 不胜感激 { "name": "myApp", "version": "1.0.0", "private": true, "description": "111", "templateInfo": { "name": "default", "typescript": false, "css": "Sass", "framework": "React" }, "scripts": { "build:weapp": "taro build --type weapp", "build:swan": "taro build --type swan", "build:alipay": "taro build --type alipay", "build:tt": "taro build --type tt", "build:h5": "taro build --type h5", "build:rn": "taro build --type rn", "build:qq": "taro build --type qq", "build:jd": "taro build --type jd", "build:quickapp": "taro build --type quickapp", "build:harmony-hybrid": "taro build --type harmony-hybrid", "dev:weapp": "npm run build:weapp -- --watch", "dev:swan": "npm run build:swan -- --watch", "dev:alipay": "npm run build:alipay -- --watch", "dev:tt": "npm run build:tt -- --watch", "dev:h5": "npm run build:h5 -- --watch", "dev:rn": "npm run build:rn -- --watch", "dev:qq": "npm run build:qq -- --watch", "dev:jd": "npm run build:jd -- --watch", "dev:quickapp": "npm run build:quickapp -- --watch", "dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch", "test": "jest" }, "browserslist": [ "defaults and fully supports es6-module", "maintained node versions" ], "author": "", "dependencies": { "@babel/runtime": "^7.20.0", "@reduxjs/toolkit": "^1.9.0", "@tarojs/components": "4.0.0-canary.9", "@tarojs/components-rn": "4.0.0-canary.9", "@tarojs/helper": "4.0.0-canary.9", "@tarojs/plugin-framework-react": "4.0.0-canary.9", "@tarojs/plugin-http": "^3.6.24", "@tarojs/plugin-platform-alipay": "4.0.0-canary.9", "@tarojs/plugin-platform-h5": "4.0.0-canary.9", "@tarojs/plugin-platform-harmony-hybrid": "4.0.0-canary.9", "@tarojs/plugin-platform-jd": "4.0.0-canary.9", "@tarojs/plugin-platform-qq": "4.0.0-canary.9", "@tarojs/plugin-platform-swan": "4.0.0-canary.9", "@tarojs/plugin-platform-tt": "4.0.0-canary.9", "@tarojs/plugin-platform-weapp": "4.0.0-canary.9", "@tarojs/react": "4.0.0-canary.9", "@tarojs/redux": "^2.2.10", "@tarojs/rn-runner": "4.0.0-canary.9", "@tarojs/rn-supporter": "4.0.0-canary.9", "@tarojs/runtime": "4.0.0-canary.9", "@tarojs/runtime-rn": "4.0.0-canary.9", "@tarojs/shared": "4.0.0-canary.9", "@tarojs/taro": "4.0.0-canary.9", "@tarojs/taro-rn": "4.0.0-canary.9", "@wuba/react-native-echarts": "^1.3.0", "ali-oss": "^6.20.0", "axios": "^1.6.7", "classnames": "^2.5.1", "crypto-js": "^4.2.0", "dayjs": "^1.11.10", "echarts": "^5.5.0", "expo": "~50.0.2", "js-base64": "^3.7.7", "linear-gradient-taro": "^1.0.1", "md5": "^2.3.0", "prop-types": "^15.8.1", "proptypes": "^1.1.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-native": "^0.73.1", "react-native-calendars": "^1.1304.1", "react-native-device-info": "^10.13.1", "react-native-gesture-handler": "^2.14.0", "react-native-pager-view": "~6.0.1", "react-native-qrcode-svg": "^6.3.0", "react-native-splash-screen": "^3.3.0", "react-native-svg": "~14.1.0", "react-native-view-shot": "^3.8.0", "react-redux": "^9.1.0", "redux-persist": "^6.0.0", "taro-code": "^4.0.1", "taro-react-echarts": "^1.2.2", "taro-ui": "^3.3.0" }, "devDependencies": { "@babel/core": "^7.24.9", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5", "@tarojs/cli": "4.0.0-canary.9", "@tarojs/taro-loader": "4.0.0-canary.9", "@tarojs/test-utils-react": "^0.1.1", "@tarojs/webpack5-runner": "4.0.0-canary.9", "@types/jest": "^29.3.1", "@types/node": "^18.15.11", "@types/webpack-env": "^1.13.6", "ahooks": "^3.7.10", "babel-preset-taro": "4.0.0-canary.9", "eslint": "^8.12.0", "eslint-config-prettier": "^9.1.0", "eslint-config-taro": "4.0.0-canary.9", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-import": "^2.12.0", "eslint-plugin-react": "^7.8.2", "eslint-plugin-react-hooks": "^4.2.0", "jest": "^29.3.1", "jest-environment-jsdom": "^29.5.0", "postcss": "^8.4.18", "prettier": "^2.8.8", "react-refresh": "^0.11.0", "stylelint": "^14.4.0", "taro-iconfont-cli": "^3.3.0", "ts-node": "^10.9.1", "webpack": "5.78.0", "webpack-bundle-analyzer": "^4.10.1", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/eslint-config": "^0.73.1", "@react-native/metro-config": "^0.73.2", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "install-peerdeps": "^3.0.3", "pod-install": "^0.1.38", "react-test-renderer": "18.2.0", "typescript": "5.0.4" } }
版本用4.0.2试试
遇到同样的错误,有解决方法吗?
同问题~
config/index.ts设置{env: { NODE_ENV: JSON.stringify(process.env.NODE_ENV) }} 可以解决
原因是warn-once这个包使用了const DEV = process.env.NODE_ENV !== "production";
相关平台
React Native
复现仓库
https://github.com/1wayticket/taro-rn-split.git
使用框架: React
复现步骤
参照教程 使用taro init后,选择分离模式创建工程后,yarn install。配置rn的输出配置,然后执行yarn build:rn --platform android导出bundle,报错如下:
期望结果
期望正常导出bundle
实际结果
打包报错
环境信息