Angular 4:导入javascript模块会产生多个错误

时间:2017-09-20 08:05:49

标签: visual-studio angular typescript

我有一个我希望在Angular 4中使用的javascript模块(即IIFE文件) 我这样做了:

declare var DataRequestsToHost: any;

import * as DataRequestsToHost from '../../../../hostScripts/DataRequestsToHost';

import语句错误:

Build:Module '../../../../hostScripts/DataRequestsToHost' was resolved to 'hostScripts/DataRequestsToHost.js', but '--allowJs' is not set.

所以我将allowJs = true添加到tsconfig.json

然后在Visual Studio中我得到2个错误:

Build:Cannot write file 'D:/VS2017Projects/ThirdPartyExam1/ThirdPartyExam1/systemjs.config.js'
because it would overwrite input file.

Build:Cannot write file 'D:/VS2017Projects/ThirdPartyExam1/ThirdPartyExam1/hostScripts/DataRequestsToHost.js'
because it would overwrite input file.

“hostsscripts”和“systemjs.config”都在tsconfig.json的exclude部分

如何解决这个问题?

问候

GregJF

0 个答案:

没有答案