【发布时间】:2022-08-02 13:43:46
【问题描述】:
我正在尝试使用 Typescript 构建在 Electron 上运行的客户端,但是,我收到以下错误:
tsconfig.json 如下:
{
\"compilerOptions\": {
\"target\": \"es5\",
\"lib\": [
\"dom\",
\"dom.iterable\",
\"esnext\"
],
\"allowJs\": true,
\"skipLibCheck\": true,
\"esModuleInterop\": true,
\"allowSyntheticDefaultImports\": true,
\"strict\": true,
\"useUnknownInCatchVariables\": false,
\"forceConsistentCasingInFileNames\": true,
\"noFallthroughCasesInSwitch\": true,
\"module\": \"esnext\",
\"moduleResolution\": \"node\",
\"resolveJsonModule\": true,
\"isolatedModules\": true,
\"noEmit\": true,
\"typeRoots\": [
\"node_modules/@types\",
\"src/types\"
],
\"jsx\": \"react-jsx\"
},
\"include\": [
\"src\"
]
}
而package.json 是这样的:
{
\"name\": \"electron-quick-start-typescript\",
\"version\": \"1.0.0\",
\"description\": \"A minimal Electron application written with Typescript\",
\"scripts\": {
\"build\": \"tsc\",
\"watch\": \"tsc -w\",
\"lint\": \"eslint -c .eslintrc --ext .ts ./src\",
\"start\": \"npm run build && electron --no-sandbox ./dist/main.js\"
},
\"type\": \"module\",
\"repository\": \"https://github.com/electron/electron-quick-start-typescript\",
\"keywords\": [
\"Electron\",
\"quick\",
\"start\",
\"tutorial\",
\"demo\",
\"typescript\"
],
\"author\": \"GitHub\",
\"license\": \"CC0-1.0\",
\"devDependencies\": {
\"@types/axios\": \"^0.14.0\",
\"@types/electron\": \"^1.6.10\",
\"@types/jquery\": \"^3.5.14\",
\"@types/node\": \"^17.0.42\",
\"@typescript-eslint/eslint-plugin\": \"^4.33.0\",
\"@typescript-eslint/parser\": \"^4.33.0\",
\"electron\": \"^18.2.3\",
\"eslint\": \"^7.32.0\",
\"typescript\": \"^4.7.2\"
},
\"dependencies\": {
\"axios\": \"^0.27.2\",
\"jquery\": \"^3.6.0\"
}
}
无论我在tsconfig 中选择什么模块类型,我都遇到了错误.任何提示表示赞赏。提前致谢。
标签: typescript electron