WebStorm + NPM + node.js + webpack - 如何避免自动重启/重建?

时间:2016-09-26 12:14:24

标签: node.js npm webpack webstorm

我目前正在使用Webstorm,node.js和NPM来运行angular2应用程序。

我使用npm:start命令和以下package.json条目运行它:"start": "concurrently \"npm run webpack:w\" \"npm run lite\"

现在问题是,我的应用程序运行了,但几秒钟之后,webstorm说它的索引和webstorm控制台显示某些第三方库的TypeScript错误(虽然它们不影响应用程序)并重新启动应用。我认为它是在我加入webpack之后开始的。

有什么方法可以抑制这种行为吗?

的package.json:

    {
  "name": "angular2-example", 
  "scripts": {
    "test": "tsc",
    "webpack:w": "webpack --watch",
    "lite": "lite-server",
    "start": "concurrently \"npm run webpack:w\" \"npm run lite\" ",
    "postinstall": "typings install",
    "webpack": "webpack",
    "typings": "typings"
  },
  "keywords": [
    "Angular2",
    "Esri"
  ],
  "author": "Tom Wayson <tom@tomwayson.com>",
  "license": "MIT",
  "dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/router": "3.0.0",
    "@angular/upgrade": "2.0.0",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.23",
    "angular2-in-memory-web-api": "0.0.18",
    "bootstrap": "^3.3.6",
    "ng2-slim-loading-bar": "^1.5.1",
    "ng2-toasty": "^1.10.1",
    "primeng": "^1.0.0-beta.16",
    "@angular2-material/button": "2.0.0-alpha.8-2",
    "@angular2-material/button-toggle": "2.0.0-alpha.8-2",
    "@angular2-material/card": "2.0.0-alpha.8-2",
    "@angular2-material/checkbox": "2.0.0-alpha.8-2",
    "@angular2-material/core": "2.0.0-alpha.8-2",
    "@angular2-material/grid-list": "2.0.0-alpha.8-2",
    "@angular2-material/icon": "2.0.0-alpha.8-2",
    "@angular2-material/input": "2.0.0-alpha.8-2",
    "@angular2-material/list": "2.0.0-alpha.8-2",
    "@angular2-material/menu": "2.0.0-alpha.8-2",
    "@angular2-material/progress-bar": "2.0.0-alpha.8-2",
    "@angular2-material/progress-circle": "2.0.0-alpha.8-2",
    "@angular2-material/radio": "2.0.0-alpha.8-2",
    "@angular2-material/sidenav": "2.0.0-alpha.8-2",
    "@angular2-material/slide-toggle": "2.0.0-alpha.8-2",
    "@angular2-material/slider": "2.0.0-alpha.8-2",
    "@angular2-material/tabs": "2.0.0-alpha.8-2",
    "@angular2-material/toolbar": "2.0.0-alpha.8-2",
    "@angular2-material/tooltip": "2.0.0-alpha.8-2"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "ts-loader": "^0.8.2",
    "typescript": "^1.8.10",
    "typings": "^1.3.2",
    "webpack": "^1.13.1"
  }
}

tsconfig:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "dist"
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

控制台输出示例:

"C:\Program Files (x86)\JetBrains\WebStorm 2016.1.3\bin\runnerw.exe" "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" run-script start

> angular2-example@0.2.2 start C:\dev
> concurrently "npm run webpack:w" "npm run lite" 

[1] 
[1] > angular2-example@0.2.2 lite C:\dev
[1] > lite-server
[1] 
[0] 
[0] > angular2-example@0.2.2 webpack:w C:\dev
[0] > webpack --watch
[0] 
[1] Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
[1] ** browser-sync config **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   watchOptions: { ignored: 'node_modules' },
[1]   server: { baseDir: './', middleware: [ [Function], [Function] ] } }
[0] ts-loader: Using typescript@2.0.3 and C:\dev\tsconfig.json
[1] [BS] Access URLs:
[1]  -------------------------------------
[1]        Local: http://localhost:3000
[1]     External: http://192.168.0.12:3000
[1]  -------------------------------------
[1]           UI: http://localhost:3001
[1]  UI External: http://192.168.0.12:3001
[1]  -------------------------------------
[1] [BS] Serving files from: ./
[1] [BS] Watching files...
[1] 16.09.26 20:33:42 304 GET /index.html
[1] 16.09.26 20:33:42 304 GET /assets/fonts/font-awesome.css
[1] 16.09.26 20:33:42 304 GET /assets/bootstrap/css/bootstrap.css
[1] 16.09.26 20:33:42 304 GET /assets/css/jquery.mCustomScrollbar.css
[1] 16.09.26 20:33:42 304 GET /assets/css/style.css
[1] 16.09.26 20:33:42 304 GET /assets/css/style-material.css
[1] 16.09.26 20:33:42 304 GET /assets/css/user.style.css
[1] 16.09.26 20:33:42 304 GET /node_modules/primeng/resources/themes/omega/theme.css
[1] 16.09.26 20:33:42 404 GET /app/resources/icons/css/font-awesome.min.css
[1] 16.09.26 20:33:42 304 GET /node_modules/primeng/resources/primeng.min.css
[1] 16.09.26 20:33:42 304 GET /assets/css/primefaces.theme.css
[1] 16.09.26 20:33:42 304 GET /assets/fonts/rio-font.css
[1] 16.09.26 20:33:42 304 GET /assets/css/newLayout.css
[1] 16.09.26 20:33:42 304 GET /assets/css/newTheme.css
[1] 16.09.26 20:33:43 304 GET /dist/vendor.bundle.js
[1] 16.09.26 20:33:43 304 GET /dist/main.bundle.js
[1] 16.09.26 20:33:44 304 GET /app/layout.html
[1] 16.09.26 20:33:44 304 GET /app/components/infopanel/welcome.component.html
[1] 16.09.26 20:33:44 304 GET /app/components/infopanel/cell-detail.component.html
[1] 16.09.26 20:33:44 304 GET /app/components/layer-control.component.html
[1] 16.09.26 20:33:45 304 GET /assets/fonts/rio.woff
[1] 16.09.26 20:33:45 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.woff2.xhtml
[1] 16.09.26 20:33:45 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.woff2.xhtml
[1] 16.09.26 20:33:45 304 GET /assets/fonts/fontawesome-webfont.woff
[1] 16.09.26 20:33:45 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.woff.xhtml
[1] 16.09.26 20:33:45 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.woff.xhtml
[1] 16.09.26 20:33:45 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.ttf.xhtml
[1] 16.09.26 20:33:45 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.ttf.xhtml
[1] [BS] File changed: dist\main.bundle.js
[1] 16.09.26 20:34:00 304 GET /index.html
[1] 16.09.26 20:34:00 304 GET /index.html
[1] 16.09.26 20:34:00 304 GET /assets/fonts/font-awesome.css
[1] [BS] File changed: dist\vendor.bundle.js
[1] [BS] File changed: dist\main.bundle.js
[1] 16.09.26 20:34:00 304 GET /assets/bootstrap/css/bootstrap.css
[1] 16.09.26 20:34:00 304 GET /assets/css/jquery.mCustomScrollbar.css
[1] 16.09.26 20:34:00 304 GET /assets/css/style.css
[1] 16.09.26 20:34:00 304 GET /assets/css/user.style.css
[1] 16.09.26 20:34:00 304 GET /assets/css/style-material.css
[1] 16.09.26 20:34:00 304 GET /node_modules/primeng/resources/themes/omega/theme.css
[1] 16.09.26 20:34:00 304 GET /node_modules/primeng/resources/primeng.min.css
[1] 16.09.26 20:34:00 404 GET /app/resources/icons/css/font-awesome.min.css
[1] 16.09.26 20:34:00 304 GET /assets/css/primefaces.theme.css

 ---> Here, the website is served and I'm already working with it, then it takes a while to show the following and restart the webapplication:


[0] Hash: 505ea9aed2c7c0ddc644
[0] Version: webpack 1.13.2
[0] Time: 20717ms
[0]                       Asset     Size  Chunks             Chunk Names
[0]       ./dist/main.bundle.js   646 kB       0  [emitted]  main
[0]     ./dist/vendor.bundle.js   3.6 MB       1  [emitted]  vendor
[0]   ./dist/main.bundle.js.map   753 kB       0  [emitted]  main
[0] ./dist/vendor.bundle.js.map  4.22 MB       1  [emitted]  vendor
[0]    [0] multi main 28 bytes {0} [built]
[0]    [0] multi vendor 436 bytes {1} [built]
[0]     + 818 hidden modules
[0]
[0] ERROR in ./app/services/map.service.ts
[0] (91,20): error TS7006: Parameter 'map' implicitly has an 'any' type.
[0] 
[1] 16.09.26 20:34:00 304 GET /assets/fonts/rio-font.css
[1] 16.09.26 20:34:00 304 GET /assets/css/newLayout.css
[1] 16.09.26 20:34:00 304 GET /assets/css/newTheme.css
[1] 16.09.26 20:34:00 304 GET /assets/fonts/font-awesome.css
[1] 16.09.26 20:34:00 304 GET /assets/bootstrap/css/bootstrap.css
[1] 16.09.26 20:34:00 304 GET /assets/css/style.css
[1] 16.09.26 20:34:00 304 GET /assets/css/jquery.mCustomScrollbar.css
[1] 16.09.26 20:34:00 304 GET /assets/css/user.style.css
[1] 16.09.26 20:34:00 304 GET /assets/css/style-material.css
[1] 16.09.26 20:34:00 304 GET /node_modules/primeng/resources/themes/omega/theme.css
[1] 16.09.26 20:34:00 304 GET /node_modules/primeng/resources/primeng.min.css
[1] 16.09.26 20:34:00 304 GET /assets/css/primefaces.theme.css
[1] 16.09.26 20:34:00 304 GET /assets/css/newLayout.css
[1] 16.09.26 20:34:00 404 GET /app/resources/icons/css/font-awesome.min.css
[1] 16.09.26 20:34:00 304 GET /assets/fonts/rio-font.css
[1] 16.09.26 20:34:00 304 GET /assets/css/newTheme.css
[1] 16.09.26 20:34:01 200 GET /dist/main.bundle.js
[1] 16.09.26 20:34:01 304 GET /dist/main.bundle.js
[1] 16.09.26 20:34:02 200 GET /dist/vendor.bundle.js
[1] 16.09.26 20:34:02 304 GET /dist/vendor.bundle.js
[1] 16.09.26 20:34:03 304 GET /app/layout.html
[1] 16.09.26 20:34:03 304 GET /app/components/infopanel/welcome.component.html
[1] 16.09.26 20:34:03 304 GET /app/components/infopanel/cell-detail.component.html
[1] 16.09.26 20:34:03 304 GET /app/components/layer-control.component.html
[1] 16.09.26 20:34:03 304 GET /app/layout.html
[1] 16.09.26 20:34:03 304 GET /app/components/infopanel/welcome.component.html
[1] 16.09.26 20:34:03 304 GET /app/components/infopanel/cell-detail.component.html
[1] 16.09.26 20:34:03 304 GET /app/components/layer-control.component.html
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.woff2.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.woff2.xhtml
[1] 16.09.26 20:34:04 304 GET /assets/fonts/rio.woff
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.woff2.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.woff2.xhtml
[1] 16.09.26 20:34:04 304 GET /assets/fonts/fontawesome-webfont.woff
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.woff.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.woff.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.woff.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.woff.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.ttf.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.ttf.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-light-webfont.ttf.xhtml
[1] 16.09.26 20:34:04 404 GET /rio/javax.faces.resource/fonts/robotocondensed-regular-webfont.ttf.xhtml

0 个答案:

没有答案