react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.33k stars 434 forks source link

index.js: [BABEL]: Cannot use import statement outside a module #700

Closed 1010nishant closed 4 months ago

1010nishant commented 4 months ago

Bug report

Summary

after installing and importing the library I am getting following error error: index.ts: [BABEL]: Cannot use import statement outside a module (While processing: /Users/nishantjangid/Desktop/TFB/TFB-Vendor-app/node_modules/react-native-document-picker/lib/commonjs/index.js)

I have configured my babel file . i am using react-native-cli

module.exports = {
  presets: ['module:metro-react-native-babel-preset', '@babel/preset-env'],
  plugins: [
    'react-native-reanimated/plugin',
    "module:react-native-dotenv",
    ["module:react-native-document-picker", {
      "copyToCacheDirectory": true
    }]
  ],
};

Reproducible sample code

Steps to reproduce

Describe what you expected to happen:

Environment info

npx react-native info output:

# System:
  OS: macOS 14.3.1
  CPU: (8) arm64 Apple M1
  Memory: 71.00 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.0
    path: ~/.nvm/versions/node/v18.17.0/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.nvm/versions/node/v18.17.0/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /usr/local/bin/pod
SDKs:
  iOS SDK: Not Found
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: /undefined
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.4
    wanted: 0.73.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

library version: 9.1.1

iOS / Android version: x.x

vonovak commented 4 months ago

Hello and thanks for asking, there is no babel config for this module, please remove it. Thank you 🙂