gpt4 book ai didi

javascript - awesome-typescript-loader 无法加载 ts 文件

转载 作者:行者123 更新时间:2023-11-30 11:45:13 24 4
gpt4 key购买 nike

在我的同伴克隆项目并运行 npm install、npm start 命令之前,一切都很好。所以我清理了我的 node_modules 以在我的环境中重现这个问题,然后我们都被困在这里。对我们可以做什么有什么建议吗?

tsc -v 2.1.1

错误日志:

ERROR in ./src/polyfills.browser.ts Module build failed: TypeError: Cannot read property 'exclude' of undefined
at applyDefaults (/Users/georgelin/Desktop/workspace/myApp/Jelly-Node/client/node_modules/awesome-typescript-loader/src/instance.ts:266:72)
at Object.ensureInstance (/Users/georgelin/Desktop/workspace/myApp/Jelly-Node/client/node_modules/awesome-typescript-loader/src/instance.ts:145:5)
at compiler (/Users/georgelin/Desktop/workspace/myApp/Jelly-Node/client/node_modules/awesome-typescript-loader/src/index.ts:37:20)
at Object.loader (/Users/georgelin/Desktop/workspace/myApp/Jelly-Node/client/node_modules/awesome-typescript-loader/src/index.ts:18:18)

@ multi polyfills

我的包.json

  "dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/material": "^2.0.0-alpha.10",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.1.1",
"@angularclass/hmr": "~1.2.0",
"@angularclass/hmr-loader": "~3.0.2",
"@baumi/angular2-select": "^2.2.1",
"angular-2-local-storage": "0.0.18",
"angular2-fontawesome": "^0.5.1",
"assets-webpack-plugin": "^3.4.0",
"core-js": "^2.4.1",
"d3": "^4.3.0",
"d3-brush": "^1.0.3",
"es6-shim": "^0.35.0",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"lodash": "^4.15.0",
"ng2-jsoneditor": "^0.1.0",
"ng2-resource-rest": "^1.5.1",
"ng2-select": "^1.1.2",
"ng2-translate": "^3.1.3",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"ts-events": "^3.1.4",
"zone.js": "^0.6.12"
},
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/core-js": "^0.9.34",
"@types/d3": "^3.5.36",
"@types/d3-brush": "^1.0.5",
"@types/d3-drag": "^1.0.5",
"@types/d3-selection": "^1.0.5",
"@types/d3-tip": "^3.5.2",
"@types/hammerjs": "^2.0.33",
"@types/jasmine": "^2.2.34",
"@types/lodash": "^4.14.37",
"@types/node": "^6.0.38",
"@types/protractor": "^1.5.20",
"@types/selenium-webdriver": "2.44.29",
"@types/source-map": "^0.1.27",
"@types/uglify-js": "^2.0.27",
"@types/webpack": "^1.12.34",
"angular2-router-loader": "^0.3.4",
"angular2-template-loader": "^0.5.0",
"awesome-typescript-loader": "^2.2.4",
"codelyzer": "^1.0.0-beta.3",
"compression-webpack-plugin": "^0.3.1",
"copy-webpack-plugin": "^2.1.3",
"css-loader": "^0.23.1",
"es6-promise": "^3.1.2",
"es6-promise-loader": "^1.0.1",
"es7-reflect-metadata": "^1.6.0",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"file-loader": "^0.8.5",
"html-webpack-plugin": "^2.15.0",
"http-server": "^0.9.0",
"imports-loader": "^0.6.5",
"istanbul-instrumenter-loader": "^0.2.0",
"json-loader": "^0.5.4",
"karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.0.2",
"karma-mocha-reporter": "^2.0.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-remap-coverage": "^0.1.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "1.8.0",
"node-sass": "^3.6.0",
"parse5": "^2.2.2",
"protractor": "^4.0.9",
"raw-loader": "0.5.1",
"rimraf": "^2.5.2",
"sass-loader": "^4.0.2",
"script-ext-html-webpack-plugin": "^1.3.2",
"source-map-loader": "^0.1.5",
"string-replace-loader": "1.0.5",
"style-loader": "^0.13.1",
"to-string-loader": "^1.1.4",
"ts-helpers": "1.1.2",
"ts-node": "^1.3.0",
"tslint": "^4.0.0-dev.0",
"tslint-loader": "^2.1.3",
"typedoc": "^0.5.0",
"typescript": "^2.0.3",
"typings": "^0.7.12",
"url-loader": "^0.5.7",
"v8-lazy-parse-webpack-plugin": "^0.3.0",
"webpack": "2.1.0-beta.25",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "2.1.0-beta.9",
"webpack-md5-hash": "^0.0.5",
"@types/isomorphic-fetch": "0.0.30",
"typed-graphql": "^1.0.1",
"webpack-merge": "^1.0.1"
},

配置文件

{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true,
"baseUrl": "./src",
"strictNullChecks": false,
"paths": {
},
"lib": [
"dom",
"es6"
],
"types": [
"lodash",
"d3"
]
},
"exclude": [
"node_modules",
"dist"
],
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"!./node_modules/**/*.ts",
"src/custom-typings.d.ts",
"typings/browser.d.ts"
],
"awesomeTypescriptLoaderOptions": {
"resolveGlobs": true,
"forkChecker": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}

最佳答案

TypeScript 2.1 具有目前不适用于 Angular 的重大更改。

将您的 Typescript 版本从 ^2.0.3 更改为 ~2.0.3,删除您的 node_modules,然后重试?

关于javascript - awesome-typescript-loader 无法加载 ts 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41216783/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com