I have a React Native project that uses package.config files in subdirectories to provide a name. eg { 'name': '@subdirectory' }
.
Then, when importing in other files, we see import foo from '@subdirectory/bar'
.
How do I configure WebStorm 2017.2.2 to accept these alias, rather than giving me 'Module not installed...'?
您可以尝试在项目视图中右键单击您的子目录,然后-> Mark directory as -> Resource Root
。
WebStorm provides no support for this React native hack (not officially documented anywhere, as far as I can tell). If you miss this feature, please follow WEB-23221 for updates.
Marking a parent folder of @subdirectory
as Resource root (note: not the subdirectory itself, but its parent dir!) should help to work out the issue.
It's just a workaround, but you can create a file with any_name.js
along the project root directory with the following content:
System.config({ "paths": {
"@subdirectory/*": "./path/to/subdirectory/*"
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.