我尝试发布一个简单的模块,像如下:如何发布可以在WebStorm中自动导入的npm模块?
文件列表是:
|--[src]
| |--[share]
| |--share.moduel.ts
| |--index.ts
|
|
|--package.json
|--index.ts
的package.json
{
"name": "my-common",
"version": "1.0.0",
"description": "",
"main": "index.ts",
"typings": "index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
index.ts
export { ShareModule } from './src/share/index';
的src/share.module.ts
import {NgModule} from "@angular/core";
import {CommonModule} from "@angular/common";
import {FormsModule} from "@angular/forms";
@NgModule({
imports: [
CommonModule,
FormsModule
],
declarations: [],
exports: [CommonModule,FormsModule]
})
export class ShareModule { }
的src/index.ts
export { ShareModule } from './share.module';
我发布NPM模块后,再npm install my-common
,我试着按Alt +为了上输入代码 'ShareModule'自动组织import语句,但它并不显示标签“添加import语句”,它的工作方式类似于Angular2 HttpModulem,FormModule等
所以,我怎么可以让我自己的模块,可以自动小鬼按键Alt +在WebStorm中输入就像其他Angular2的官方模块一样?我错过了一些关键点吗?