【发布时间】:2016-08-18 15:32:25
【问题描述】:
我正在一个由 Tomcat 托管的项目中编写 Angular 2 代码。我现在添加一些 Angular 2 代码。
我使用了使用实时监视编译器的quickstart 项目。这意味着它会在检测到更改时编译ts 文件。
但是,现在所有的项目都由 Tomcat 托管。那么,如何编译ts 文件呢?手动?
每次代码更改都按build project?
我看到package.json 包括这个:
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
但是当我跑步时
➜ angular2 git:(push_n) ✗ npm tsc:w
Usage: npm <command>
where <command> is one of:
access, adduser, bin, bugs, c, cache, completion, config,
ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get,
help, help-search, i, init, install, install-test, it, link,
list, ln, logout, ls, outdated, owner, pack, ping, prefix,
prune, publish, rb, rebuild, repo, restart, root, run,
run-script, s, se, search, set, shrinkwrap, star, stars,
start, stop, t, tag, team, test, tst, un, uninstall,
unpublish, unstar, up, update, v, version, view, whoami
更新
我听从了 Supun 的指示
现在我明白了:
➜ tsc -w /Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/*
error TS6053: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/app.ts' not found.
error TS6053: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/node_modules.ts' not found.
error TS6053: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/typings.ts' not found.
error TS6054: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/index.html' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
error TS6054: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/package.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
error TS6054: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/pushResult.html' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
error TS6054: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/styles.css' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
error TS6054: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/systemjs.config.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
error TS6054: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/tsconfig.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
error TS6054: File '/Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/angular2/typings.json' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
11:45:17 PM - Compilation complete. Watching for file changes.
但是我更改了文件,控制台中没有出现日志
【问题讨论】:
-
如果你使用像 Gulp 或 Grunt 这样的构建工具会怎样??
-
为什么
npm tsc:w无法识别?
标签: macos tomcat intellij-idea angular typescript