将模块从commonjs更改为其他任何东西都会破坏角度

时间:2018-02-27 16:43:36

标签: javascript angular typescript

在我的tsconfig.json文件中,我有:

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": false,
    "baseUrl": "./node_modules/"
  },
  "exclude": [
    "node_modules",
    "typings"
  ]
}

透明到JavaScript工作正常,但在浏览器中抛出错误。 (未定义出口)。如果我按照this answer中的说明删除了commonJS,则它无法再解析导入语句:

 import { angular } from "angular";

......它不会透露。我在这里缺少什么?

更新

根据评论中的要求,项目结构的文件树。该树实际上有250多个目录和几千个文件,它缩写为仅显示相关位:

.
├── bugzy-work-timer
│   ├── app.php
│   ├── css
│   │   └── 01-timer.css
│   ├── js
│   │   └── footer
│   │       ├── timer.js
│   │       └── timer.ts
│   ├── manifest.sig
│   ├── manifest.xml
│   └── tests
├── move-unused-apps.sh
├── node_modules
│   └── angular
│       ├── angular-csp.css
│       ├── angular.js
│       ├── angular.min.js
│       ├── angular.min.js.gzip
│       ├── angular.min.js.map
│       ├── bower.json
│       ├── index.js
│       ├── LICENSE.md
│       ├── package.json
│       └── README.md
├── package-lock.json
├── phpunit.xml
├── tsconfig.json
├── tsd.json
├── tslint.json
├── typings
│   ├── index.d.ts
│   ├── modules
│   │   └── angular
│   │       ├── index.d.ts
│   │       └── typings.json
│   └── tsd.d.ts
└── update-all.sh

0 个答案:

没有答案