Is create-react-native-app supported?
See original GitHub issueI’m attempting to use this plugin with a create-react-native-app (CRNA) but when importing a .graphql file into a typescript file, I’m seeing the error:
Unable to resolve ./query.graphql" from "src/Welcome/index.tsx`: The module `./query.graphql` could not be found.
I noticed the babel-plugin-inline-import-graphql-ast
package, but it works with react-app-rewired
which is for create-react-app and not create-react-native-app.
Any ideas?
Here’s my .babelrc
{
"plugins": ["import-graphql"],
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source"
]
}
}
}
and package.json
{
"name": "tortuga",
"version": "0.1.0",
"private": true,
"devDependencies": {
"@types/jest": "^22.2.3",
"@types/react": "^16.3.14",
"@types/react-native": "^0.55.16",
"@types/react-test-renderer": "^16.0.1",
"apollo-codegen": "^0.19.1",
"babel-plugin-import-graphql": "^2.4.4",
"react-app-rewired": "^1.5.2",
"react-native-scripts": "1.14.0",
"react-native-typescript-transformer": "^1.2.9",
"tslint-react": "^3.6.0",
"typescript": "^2.8.3"
},
"main": "./src/index.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest",
"generate-schema": "apollo-codegen introspect-schema http://localhost:8080/graphql --output lib/schema.json"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"apollo-boost": "^0.1.7",
"expo": "^27.0.2",
"graphql": "^0.13.2",
"react": "16.4.0",
"react-apollo": "^2.1.4",
"react-native": "~0.55.2",
"tslint": "^5.10.0"
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Introducing Create React Native App
With Create React Native App, there's no need to use Xcode or Android Studio, and you can develop for your iOS device using...
Read more >expo/create-react-native-app - GitHub
Expo Client supports running any project that doesn't have custom native modules added.
Read more >create-react-native-app - npm
Start using create-react-native-app in your project by running `npm i create-react-native-app`. There are 5 other projects in the npm ...
Read more >How to create React Native App for Android, iOS and Web ...
Step 1: Init a React Native Application: · Step 2: Run this new app in Android (optional) · Step 3: Web Setup.
Read more >The complete guide to React Native for Web - LogRocket Blog
Yes ! With React Native for Web, developers can write a single React Native application that can run natively on Android and iOS,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Changing the
module
compiler option intsconfig.json
fromcommonjs
toes2015
allowed the js bundle to build.My IDE was still reporting an error because it couldn’t find the module for my
.graphql
file, which was fixed by your suggestion of addingfileExtensions.d.ts
withThanks for your help debugging.
Oh it sounds like just a type issue. What i did was make a
types
folder in my project root with afileExtensions.d.ts
file like this in it:And then add that folder to my
typeRoots
intsconfig.json
: