2017-05-05 50 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識別包的內部出口。