簡體   English   中英

分離TypeScript和JavaScript文件

[英]Separating TypeScript and JavaScript files

我從《英雄之旅》教程https://angular.io/docs/ts/latest/guide/setup.html中克隆了項目。

我想將.js文件分離到另一個目錄,因為現在我在一個目錄中同時包含.ts,.js和.js.map文件。

我嘗試從以下答案中解決問題: 將Angular2 TypeScript文件和JavaScript文件分離到不同的文件夾中,也許是“ dist”,但是在systemjs.config.js和tsconfig.json中進行更改后,出現錯誤:

Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:18 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/app/app.module
    Error: XHR error (404 Not Found) loading http://localhost:3000/app/app.module
        at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:1056:39)
        at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:424:31)
        at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:191:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:486:38)
    Error loading http://localhost:3000/app/app.module as "./app/app.module" from http://localhost:3000/main.js
        at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:1056:39)
        at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:424:31)
        at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:191:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:486:38)
    Error loading http://localhost:3000/app/app.module as "./app/app.module" from http://localhost:3000/main.js

   "files.exclude": {
    "**/*.js.map": true,
    "**/*.js": {
        "when": "$(basename).ts"
    }
},

您的用戶設置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM