react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Cannot initialize a vanilla js react-native project

Open Risto-Stevcev opened this issue 2 years ago • 3 comments

Description

I'm trying to get npx react-native@latest init AwesomeProject working with vanilla js and babel

React Native Version

0.71.7

Output of npx react-native info

info Fetching system and libraries information... System: OS: Linux 6.1 Void CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz Memory: 8.61 GB / 15.30 GB Shell: 5.9 - /bin/zsh Binaries: Node: 19.9.0 - ~/.nvm/versions/node/v19.9.0/bin/node Yarn: Not Found npm: 9.6.3 - ~/.nvm/versions/node/v19.9.0/bin/npm Watchman: Not Found SDKs: Android SDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.7199119 Languages: Java: 11.0.12 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.7 => 0.71.7 npmGlobalPackages: react-native: Not Found

Steps to reproduce

Steps to reproduce:

  1. npx [email protected] init AwesomeProject
  2. Rename App.tsx to App.jsx and remove typescript declarations. Note that npm start and npm run android work fine without typescript, and you can safely remove tsconfig.json
  3. Try to run the tests using npm test and note that it works.
  4. Try to rename App-test.tsx to App-test.jsx, which should work, but throws this error:
    /home/risto/projects/AwesomeProject/__tests__/App-test.jsx:5
    import 'react-native';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

I tried to get jest to work by adding the @babel/plugin-transform-modules-commonjs plugin to babel, but it didn't work.

Snack, code example, screenshot, or link to a repository

https://github.com/Risto-Stevcev/react-native-vanilla-js-starter/

Risto-Stevcev avatar Apr 24 '23 14:04 Risto-Stevcev

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 22 '23 05:10 github-actions[bot]

I think this ticket is still important -- it would be good to ensure that react-native is easily usable without Typescript or babel in order to easily support other transpilers

Risto-Stevcev avatar Oct 22 '23 16:10 Risto-Stevcev

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 20 '24 05:04 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Apr 27 '24 05:04 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Apr 27 '24 05:04 github-actions[bot]