任何想法如何处理?我的意思是jquery-ui似乎不是amd而且我不知道如何管理它,任何想法?
我真的变得疯狂,因为我无法找到解决方案.我想要归档的是将带有配置的JSON文件导入到我的TypeScript文件中.我了解到我需要一个声明文件.所以我在我的项目中添加了一个json-loader.d.ts文件.我也尝试过几个级别(root,typings文件夹,custom_typings文件夹),因为这是我找到的解决方案.文件内容如下所示:
declare module "json!*" {
let json: any;
export = json;
}
declare module "*.json" {
const value: any;
export default value;
}Run Code Online (Sandbox Code Playgroud)
但是编译器仍然告诉我,导入JSON文件是不可能的,因为它不是模块.那么,编译器如何知道,有这样的声明文件?
我已经尝试像这样修改我的tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "dist",
"typeRoots": [
"./node_modules/@types",
"./typings"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
Run Code Online (Sandbox Code Playgroud)
但它仍然无效.有什么建议?
谢谢!