./node_modules/graphql/index.mjs 中的错误 49:0-53:205 无法重新导出命名导出
Posted
技术标签:
【中文标题】./node_modules/graphql/index.mjs 中的错误 49:0-53:205 无法重新导出命名导出【英文标题】:ERROR in ./node_modules/graphql/index.mjs 49:0-53:205 Can't reexport the named export 【发布时间】:2019-06-30 09:14:14 【问题描述】:我尝试使用webpack 4
将基于typescript
的应用程序构建为graphql
服务器。
但得到如下错误:
ERROR in ./node_modules/graphql/index.mjs 49:0-53:205
Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available)
@ ./graphql/schema.ts
@ ./graphql/server.ts
ERROR in ./node_modules/graphql/index.mjs 64:0-98:42
Can't reexport the named export 'BreakingChangeType' from non EcmaScript module (only default export is available)
@ ./graphql/schema.ts
@ ./graphql/server.ts
ERROR in ./node_modules/graphql/index.mjs 36:0-47:50
Can't reexport the named export 'DEFAULT_DEPRECATION_REASON' from non EcmaScript module (only default export is available)
@ ./graphql/schema.ts
@ ./graphql/server.ts
ERROR in ./node_modules/graphql/index.mjs 64:0-98:42
Can't reexport the named export 'DangerousChangeType' from non EcmaScript module (only default export is available)
@ ./graphql/schema.ts
@ ./graphql/server.ts
ERROR in ./node_modules/graphql/index.mjs 49:0-53:205
Can't reexport the named export 'DirectiveLocation' from non EcmaScript module (only default export is available)
@ ./graphql/schema.ts
@ ./graphql/server.ts
ERROR in ./node_modules/graphql/index.mjs 58:0-60:675
Can't reexport the named export 'FieldsOnCorrectTypeRule' from non EcmaScript module (only default export is available)
@ ./graphql/schema.ts
@ ./graphql/server.ts
.....
【问题讨论】:
我似乎在 s-s-r 模式下使用 Apollo Angular 时遇到了同样的问题。 @Edgaras Karka 你设法解决了吗? 【参考方案1】:我今天在使用 Angular Universal s-s-r 时遇到了完全相同的问题。
我的解决方案是将此行包含在我的 webpack 配置文件中的 externals
对象中。
externals:
'./dist/server/main': 'require("./server/main")'
,
对于那些在使用 Angular 8 和 Apollo for Graphql 时遇到同样问题的人,这是一份让我心潮澎湃的迁移指南:Angular Universal v8 upgrade guide
【讨论】:
以上是关于./node_modules/graphql/index.mjs 中的错误 49:0-53:205 无法重新导出命名导出的主要内容,如果未能解决你的问题,请参考以下文章