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

Remove the CLI config file #73

Open
orta opened this issue Jul 18, 2018 · 3 comments
Open

Remove the CLI config file #73

orta opened this issue Jul 18, 2018 · 3 comments

Comments

@orta
Copy link
Contributor

orta commented Jul 18, 2018

👋 - I was looking at updating the docs for RN around the cli-config.js file, and in digging around in the RN source code, I noticed that we might not need to do that anymore.

Basically, we added the cli-config to ensure that this code could resolve to this dep.

But passing in

yarn start --transformer "node_modules/react-native-typescript-transformer/index.js" --sourceExts "ts"

should also work, and in an ideal case support in RN could be improved to handle

yarn start --transformer "react-native-typescript-transformer" --sourceExts "ts"

Meaning a bit less process, it's a trade-off, and not one I'm sure I want to recommend yet - but worth noting

@VitorLuizC
Copy link

--transformer "react-native-typescript-transformer" looks for transformer in root instead of node_modules. Full transformer path is required otherwise it throws the error below.

ENOENT: no such file or directory, open '/MY_PATH/react-native-typescript-transformer'

The second problem is extensions also need tsx, without tsx it won't find any TypeScript component.

So, the right command would be

yarn start --transformer "node_modules/react-native-typescript-transformer/index.js" --sourceExts "ts,tsx"

@ds300
Copy link
Owner

ds300 commented Jul 23, 2018

Good point. My thinking behind recommending the rn-cli.config.js file is that there are a bunch of ways to run the packager. e.g. react-native run-android, react-native run-ios, react-native bundle, etc. All of these would require the extra config to be passed. So having a central config file reduces the burden of duplication in your package.json scripts entry. But also it lets people use the react-native cli directly, which should cause less friction for people following tutorials?

So yeah, I'm not crazy about the proliferation of config files, but not sure that getting rid of this one would help anyone 🤷‍♀️

@orta
Copy link
Contributor Author

orta commented Jul 23, 2018

Yeah, I agree, I don't see much value also - I went and documented this file a bit on the site facebook/react-native-website#462

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

3 participants