Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用[email protected]开发react-native,怎么集成react-native-pushy #423

Open
cc-Listener opened this issue Dec 22, 2023 · 2 comments

Comments

@cc-Listener
Copy link

运行pushy bundle --platform android --entryFile ./src/app.tsx 报错信息如下
Bundling with react-native: 0.69.3
react-native-update-cli: 1.13.0
react-native-update: 9.1.6
Running bundle command: node node_modules/react-native/local-cli/cli.js bundle --assets-dest .pushy/intermedia/android --bundle-output .pushy/intermedia/android/index.bundlejs --dev false --entry-file ./src/app.tsx --platform android --reset-cache
warn Package @ant-design/icons-react-native contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
warn Package @ant-design/react-native contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
warning: the transform cache was reset.
Welcome to Metro!
Fast - Scalable - Integrated
error src/app.tsx: Import statement may only appear at top level in file src/app.tsx at 4:2.
Error: Import statement may only appear at top level in file src/app.tsx at 4:2
at minifyCode (/xx/node_modules/metro-transform-worker/src/index.js:101:13)
at transformJS (/xx/node_modules/metro-transform-worker/src/index.js:319:28)
at transformJSWithBabel (/xx/node_modules/metro-transform-worker/src/index.js:410:16)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.transform (/xx/node_modules/metro-transform-worker/src/index.js:571:12)
info Run CLI with --verbose flag for more details.
Error: "react-native bundle" command exited with code 1.
at ChildProcess. (/.nvm/versions/node/v16.17.0/lib/node_modules/react-native-update-cli/lib/bundle.js:83:16)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1093:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

@sunnylqm
Copy link
Contributor

看下app.tsx里,import语句有问题

@cc-Listener
Copy link
Author

@sunnylqm
image
是不是默认的babel配置导致的问题
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: true
}]
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants