Angular 从内部文件导入成员将抛出“;未找到模块:错误:Can';t解决”;
我正试图从Angular 从内部文件导入成员将抛出“;未找到模块:错误:Can';t解决”;,angular,typescript,ionic-framework,Angular,Typescript,Ionic Framework,我正试图从@ionic/core的内部文件中导入函数和接口。这些成员不是由模块直接导出的,而是在文件dist/types/utils/transition中导出的 在vscode上使用它们不会产生任何错误,我可以使用它们: 但是,当我使用ng build时,我发现模块未找到:错误:无法解析,并且字段“browser”不包含有效的别名配置 此外,我还尝试了。/../node\u modules/@ionic/core/dist/types/utils/transition,但没有成功的结果 哪一
@ionic/core
的内部文件中导入函数
和接口
。这些成员不是由模块直接导出的,而是在文件dist/types/utils/transition
中导出的
在vscode上使用它们不会产生任何错误,我可以使用它们:
但是,当我使用ng build
时,我发现模块未找到:错误:无法解析,并且字段“browser”不包含有效的别名配置
此外,我还尝试了。/../node\u modules/@ionic/core/dist/types/utils/transition
,但没有成功的结果
哪一种方法是最好的?()
更新:
仅导入接口TransitionOptions
即可,但是无法导入函数getIonPageElement
。它似乎是在index-356fa4e5
中导出的,我无法直接导入
完整错误日志:
ERROR in ./src/app/app-page-transitions.ts
Module not found: Error: Can't resolve '../../node_modules/@ionic/core/dist/types/utils/transition' in '/home/user/Projects/new-project/src/app'
resolve '../../node_modules/@ionic/core/dist/types/utils/transition' in '/home/user/Projects/new-project/src/app'
using description file: /home/user/Projects/new-project/package.json (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
using description file: /home/user/Projects/new-project/node_modules/@ionic/core/package.json (relative path: ./dist/types/utils/transition)
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition is not a file
.ts
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.js doesn't exist
as directory
existing directory
using path: /home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index
using description file: /home/user/Projects/new-project/node_modules/@ionic/core/package.json (relative path: ./dist/types/utils/transition/index)
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.js doesn't exist
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.ts]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.tsx]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.mjs]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition.js]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.ts]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.tsx]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.mjs]
[/home/user/Projects/new-project/node_modules/@ionic/core/dist/types/utils/transition/index.js]
@ ./src/app/app-page-transitions.ts 2:0-96 11:20-37 16:51-68
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi ./src/main.ts