你如何使用systemjs冻结angular2版本?

时间:2016-08-10 19:03:32

标签: angular systemjs

这是一个noob问题,但是每次团队发布向后兼容的更改时,我都会试图阻止我的Angular2应用程序崩溃。我正在使用strategy from A2 university进行生产部署,其中包括从NPM CDN下载libs(包括angular2)。我有一个package.json文件,指定“@ angular / core”:“2.0.0-rc.4”,但Systemjs似乎给了我一个不同的版本,昨天打破了我的应用程序。所以我的问题是:

如何使用Systemjs冻结NPM CDN组件版本?

(我知道有很多很多其他工具和捆绑包,但我的经验是很难让它们与Angular2保持兼容,所以我真的很想使用推荐的(SystemJS - NPM CDN) Angular2策略。)

感谢您的帮助!

我的tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts",
    "typings/browser/ambient/es6-shim/index.d.ts"
  ]
}

我的package.json:

{
  "name": "awsec",
  "version": "0.0.2",
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.4",

    "systemjs": "0.19.27",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.9",
    "typings": "^1.0.4"
  }
}

我的index.html中的一个片段:

<!-- Angular core libs -->
<script src="https://npmcdn.com/zone.js@0.6.12/dist/zone.js"></script>
<script src="https://npmcdn.com/reflect-metadata@0.1.3/Reflect.js"></script>
<script src="https://npmcdn.com/systemjs@0.19.31/dist/system.js"></script>

0 个答案:

没有答案