React-admin: Set up project in IDE's

Created on 26 Sep 2017  路  8Comments  路  Source: marmelab/react-admin

Probably there isn't AOR issue, but I could not solution.

After reading guide I had been configure app, but IDE's (IDEA based like WebStorm/PHPStorm and VSCode) can't resolve imports from admin-on-rest, but react imports works well. WebStorm says Cannot resolve symbol %component_name%

So what I should set up to get full IDE autocompletion?

Most helpful comment

@afilp : you can add

    "jsnext:main": "src/index",

to the package.json of react-admin (so editing the entry in node_modules/react-admin/package.json for IDEA to get autocompletion. IDEA can't handle dynamically named es5 modules. (I created an issue for this on the IDEA issue list, and this is currently the workaround)

All 8 comments

Hi, and thanks for your question. As explained in the admin-on-rest contributing guide, the right place to ask a "How To" question, get usage advice, or troubleshoot your own code, is StackOverFlow.

This makes your question easy to find by the core team, and the developer community. Unlike Github, StackOverFlow has great SEO, gamification, voting, and reputation. That's why we chose it, and decided to keep GitHub issues only for bugs and feature requests.

So I'm closing this issue, and inviting you to ask your question at:

http://stackoverflow.com/questions/tagged/admin-on-rest

And once you get a response, please continue to hang out on the admin-on-rest channel in StackOverflow. That way, you can help newcomers and share your expertise!

@gephaest @djhi I have the same problem, isn't this an "issue"? I mean, could the code be setup differently so that all IDEs (like IDEA) can resolve the AOR symbols?

See here for example, no imported symbols can be resolved:
image

Thanks!

I don't how IDEA works. What I can tell you is that I don't have any imports problems in vscode: I even get autocompletion for them

@afilp : you can add

    "jsnext:main": "src/index",

to the package.json of react-admin (so editing the entry in node_modules/react-admin/package.json for IDEA to get autocompletion. IDEA can't handle dynamically named es5 modules. (I created an issue for this on the IDEA issue list, and this is currently the workaround)

Thanks, @tkvw ! I added it so that my file had this, as I wasn't sure if jsnet:main replaced or augmented main.

"main": "lib/index",
"jsnext:main": "src/index",
"scripts": {

Anyway, that fixed it!

Adding

"jsnext:main": "src/index",

to the package.json of admin-on-rest, rather than react-admin worked for me.

I encounter the same problem with Intellij IDEA, adding
"jsnext:main": "src/index",
to the package.json of node_modules/ra-core didn't change anything for me. Any idea ?

+1 here @fzaninotto asked a question on SO https://stackoverflow.com/q/54118304/1491212

Was this page helpful?
0 / 5 - 0 ratings

Related issues

9747749366 picture 9747749366  路  3Comments

kdabir picture kdabir  路  3Comments

yangjiamu picture yangjiamu  路  3Comments

pixelscripter picture pixelscripter  路  3Comments

fzaninotto picture fzaninotto  路  3Comments