英文:
Uncaught TypeError: (0 , tslib_1.__exportStar) is not a function
问题
尝试将@aws-amplify/ui-angular添加到我的应用程序中,无论我尝试什么,都会出现这个错误。当我点击main.js时,就会显示出来。我已经尝试更改节点版本,升级和降级amplify/type script版本。
使用:
"typescript": "~4.8.4",
"@aws-amplify/ui-angular": "^4.0.1", // 也尝试了4.0.4
"aws-amplify": "^5.3.3",
/*!***********************************************************!*\
!*** ./node_modules/@aws-crypto/sha256-js/build/index.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var tslib_1 = __webpack_require__(/*! tslib */ 29501);
(0, tslib_1.__exportStar)(__webpack_require__(/*! ./jsSha256 */ 12008), exports);
(__webpack_require__(/*! ./jsSha256 */ 12008), exports);
这个是红色下划线的。
编辑:根据评论请求添加tsconfig.json
{
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
},
"compileOnSave": false,
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"lib": [ "es2018", "dom", "esnext" ],
"module": "esnext",
"moduleResolution": "node",
"outDir": "./dist/out-tsc",
"paths": {
"@core/*": [ "src/app/core/*" ],
"@shared/*": [ "src/app/shared/*" ],
"@services/*": [ "src/app/shared/services/*" ],
"@enums/*": [ "src/app/types/enums/*" ],
"@interfaces/*": [ "src/app/types/interfaces/*" ],
"@mocks/*": [ "src/app/types/mocks/*" ],
"@classes/*": [ "src/app/types/classes/*" ],
// crypto browser warning fix...
// https://stackoverflow.com/questions/54162297/module-not-found-error-cant-resolve-crypto
"crypto": [
"node_modules/crypto-js"
]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"target": "es2022",
"typeRoots": [ "node_modules/@types" ],
"useDefineForClassFields": false
},
"exclude": [
"./amplify",
"./config/**/*",
"./coverage/**/*",
"./dist",
"./e2e",
"./node_modules",
"./scripts",
".serverless",
".webpack/**/*",
"_warmup/**/*",
".vscode/**/*",
".idea/**/*",
"commitlint.config.js",
"aws-exports.js",
"jest.config.js"
],
"include": [
"src/**/*.ts"
]
}
英文:
Trying to add @aws-amplify/ui-angular to my application and no matter what I try I get this error. When I click on main.js this is what shows up. I have tried changing node versions, upgrading and downgrading amplify/type script versions.
using:
"typescript": "~4.8.4"
"@aws-amplify/ui-angular": "^4.0.1", // tried 4.0.4 as well
"aws-amplify": "^5.3.3",
/*!***********************************************************!*\
!*** ./node_modules/@aws-crypto/sha256-js/build/index.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var tslib_1 = __webpack_require__(/*! tslib */ 29501);
(0, tslib_1.__exportStar)(__webpack_require__(/*! ./jsSha256 */ 12008), exports);
(__webpack_require__(/*! ./jsSha256 */ 12008), exports);
this is red underlined
EDIT: adding tsconfig.json, per comment request
{
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
},
"compileOnSave": false,
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"lib": [ "es2018", "dom", "esnext" ],
"module": "esnext",
"moduleResolution": "node",
"outDir": "./dist/out-tsc",
"paths": {
"@core/*": [ "src/app/core/*" ],
"@shared/*": [ "src/app/shared/*" ],
"@services/*": [ "src/app/shared/services/*" ],
"@enums/*": [ "src/app/types/enums/*" ],
"@interfaces/*": [ "src/app/types/interfaces/*" ],
"@mocks/*": [ "src/app/types/mocks/*" ],
"@classes/*": [ "src/app/types/classes/*" ],
// crypto browser warning fix...
// https://stackoverflow.com/questions/54162297/module-not-found-error-cant-resolve-crypto
"crypto": [
"node_modules/crypto-js"
]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"target": "es2022",
"typeRoots": [ "node_modules/@types" ],
"useDefineForClassFields": false
},
"exclude": [
"./amplify",
"./config/**/*",
"./coverage/**/*",
"./dist",
"./e2e",
"./node_modules",
"./scripts",
".serverless",
".webpack/**/*",
"_warmup/**/*",
".vscode/**/*",
".idea/**/*",
"commitlint.config.js",
"aws-exports.js",
"jest.config.js"
],
"include": [
"src/**/*.ts"
]
}
答案1
得分: 0
显然,我只是在我的tsconfig.json中指向了一个错误的tslib位置。删除它解决了这个问题。
英文:
Apparently I was simply pointing to an incorrect tslib location in my tsconfig.json. Removing it solved the issue.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论