在uni-app项目中使用typescript,编译的时候报错,说没有合适的loader处理文件类型
Module parse failed: Unexpected token (22:17)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
一开始在HBuilder中装typescript编译插件不行
用npm 在项目里装了个ts-loader,然后又配了个tsconfig.json,配置如下
{
"compilerOptions": {
"target": "es5",
"strict": true,
"module": "es2015",
"moduleResolution": "node"
},
"files": [
"typings/zgapp.d.ts"
]
}
最后还还有一行报错:
ERROR Build failed with errors.
但是项目可以运行,ts文件也可以用