5

任何人都知道如何 Browserify-Shim Angular 2,同时将 Angular 保持在外部而不将其捆绑在构建中?

//package.json
{
  "name": "testapp",
  "version": "1.0.0",
  "main": "./app.js",
  "browserify-shim": {
    "angular2": "global:angular2"
  },
  "browserify": {
    "transform": [ "browserify-shim" ]
  },
  "dependencies": {
    "browserify-shim": "~3.2.0"
  }
}

...

//app.ts
import {Component, View, bootstrap, NgFor} from 'angular2';

结果:

TypeError: angular2_1 is undefined
4

0 回答 0