无法手动或自动构建main.jsbundle文件

时间:2019-05-09 23:38:43

标签: javascript ios xcode react-native node-modules

我试图在以./index.js作为条目文件的命令行(MacOSX Mojave 10.14.4(18E226))中手动构建/ios/main.jsbundle文件。但是我没有成功。

然后我在Xcode(版本10.2.1(10E1001))中使用此文件。

我正在使用根目录中的以下命令来构建main.jsbundle:

$ react-native bundle --entry-file ./index.js --platform ios --dev false --bundle-output main.jsbundle

OR

$ react-native bundle --entry-file ./index.js --platform its --bundle-output main.jsbundle

这与--verbose标志一起出现:

Loading dependency graph, done.
error index.js: Plugin/Preset files are not allowed to export objects, only functions. In /Users/me/MyApp/node_modules/babel-preset-react-native-stage-0/decorator-support.js
debug Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/me/MyApp/node_modules/babel-preset-react-native-stage-0/decorator-support.js
    at createDescriptor (/Users/me/MyApp/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)
    at /Users/me/MyApp/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
    at Array.map (<anonymous>)
    at createDescriptors (/Users/me/MyApp/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPresetDescriptors (/Users/me/MyApp/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
    at presets (/Users/me/MyApp/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
    at mergeChainOpts (/Users/me/MyApp/node_modules/@babel/core/lib/config/config-chain.js:320:26)
    at /Users/me/MyApp/node_modules/@babel/core/lib/config/config-chain.js:283:7
    at mergeExtendsChain (/Users/me/MyApp/node_modules/@babel/core/lib/config/config-chain.js:299:21)

我试图找到一个类似的问题,但没有。

我还试图清理缓存,清理看守员的手表,杀死地铁捆绑器,重新启动Xcode,更新brew,npm。

这些是我的文件:

  • package.json文件:
{
  "name": "MyApp",
  "version": "0.2.0",
  "private": true,
  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@babel/plugin-proposal-decorators": "^7.4.4",
    "@babel/preset-env": "^7.4.4",
    "@babel/preset-react": "^7.0.0",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "flow-bin": "^0.77.0",
    "flow-remove-types": "^1.2.3",
    "jest": "^24.8.0",
    "jest-react-native": "^18.0.0",
    "react-test-renderer": "16.3.1"
  },
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "test": "jest",
    "build": "flow-remove-types --all --pretty ./flow_src/ -d ./src",
    "flow": "flow"
  },
  "jest": {
    "preset": "react-native",
    "setupFiles": [
      "<rootDir>/test/config/setup.js"
    ],
    "testPathIgnorePatterns": [
      "/test/config/setup",
      "/test/config/assetsTransformer"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test/config/assetsTransformer.js",
      "\\.(css|less)$": "<rootDir>/test/config/assetsTransformer.js"
    }
  },
  "dependencies": {
    "@types/react": "^16.8.17",
    "@types/react-native": "^0.57.53",
    "@types/react-navigation": "^3.0.7",
    "assert": "^1.5.0",
    "babel-preset-react-native": "^5.0.2",
    "braces": "^2.3.2",
    "moment": "^2.24.0",
    "react": "^16.8.6",
    "react-native": "^0.59.8",
    "react-native-collapsible": "^0.9.0",
    "react-native-dialog": "^5.6.0",
    "react-native-doc-viewer": "^2.7.8",
    "react-native-elements": "^0.19.1",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-fs": "^2.13.3",
    "react-native-orientation": "^3.1.3",
    "react-native-pdf": "^3.0.17",
    "react-native-picker-select": "^4.4.0",
    "react-native-progress": "^3.6.0",
    "react-native-render-html": "^3.10.0",
    "react-native-timeago": "^0.4.0",
    "react-native-vector-icons": "^4.6.0",
    "react-native-video": "^3.2.1",
    "react-navigation": "^2.18.3",
    "yallist": "^3.0.3"
  }
}

*。babelrc文件:

{
  "presets": [
    "babel-preset-react-native-stage-0/decorator-support"
  ],
  "env": {
    "development": {
      "plugins": [
        "transform-react-jsx-source"
      ]
    }
  }
}
  • 系统信息
info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
      Memory: 20.87 GB / 32.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.1.0 - /usr/local/bin/node
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    IDEs:
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.8.6 => 16.8.6 
      react-native: ^0.59.8 => 0.59.8 
    npmGlobalPackages:
      create-react-native-app: 2.0.2
      react-native-cli: 2.0.1 

0 个答案:

没有答案