2017-05-05 52 views
0

当我使用material-ui包我得到很好的自动完成功能在Webstorm(Ctrl +空格键):自动完成在Webstorm为我定制的NPM模块(ES6 /巴贝尔)

autocompletion material

我想这可能有事情做与事实软件包包括index.es.js文件:

import _AppBar from './AppBar'; 
export { _AppBar as AppBar }; 
import _AutoComplete from './AutoComplete'; 
export { _AutoComplete as AutoComplete }; 
import _Avatar from './Avatar'; 
export { _Avatar as Avatar }; 
import _Badge from './Badge'; 
export { _Badge as Badge }; 
import _BottomNavigation from './BottomNavigation'; 
... 

所以我生成我自己index.es.js在我的自定义模块NPM并把它旁边的transpiled index.js :

import {ActionTypes as _ActionTypesElements} from './reducers/elements/elements'; 
export { _ActionTypesElements as ActionTypes }; 

import {ActionTypes as _ActionTypesAppState} from './reducers/appState/appState'; 
export { _ActionTypesAppState as ActionTypesAppState }; 

import _appStateActions from './reducers/appState/appState_actions'; 
export { _appStateActions as appStateActions }; 
... 

可是我没有得到任何自动完成:

autocomplete me

任何想法,为什么?

+0

你有没有安装任何材质插件?在文件 - >设置 - >插件中?你是否安装你的npm模块,如:'npm file-editor install'? – Edwin

+0

@Edwin我找到了答案,显然我必须在package.json中添加一个名为jsnext:main的字段。 – Guy

回答

1

找到了答案:

只好一个jsnext补充:主要场故宫模块的package.json:

的package.json:

... 
"module": "./index.js", 
"jsnext:main": "./index.es.js", 
... 

Webstorm识别包的内部出口。