我有一个我希望在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