Reputation: 897
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...'?
Upvotes: 3
Views: 1246
Reputation: 330
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/*"
}
});
Upvotes: 0
Reputation: 93728
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.
Upvotes: 1
Reputation: 3336
You can try to right click your subdirectory in the project view, then
-> Mark directory as -> Resource Root
.
Upvotes: 4