Typescript ./node_modules/graphql/index.mjs 49:0-53:205 Can';t重新导出指定的导出
我尝试使用Typescript ./node_modules/graphql/index.mjs 49:0-53:205 Can';t重新导出指定的导出,typescript,webpack,graphql,webpack-4,Typescript,Webpack,Graphql,Webpack 4,我尝试使用webpack4将基于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/ser
webpack4
将基于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
.....
我今天使用角度通用SSR时运行的是完全相同的问题 我的解决方案是将这一行包含到我的webpack配置文件中的
externals
对象中
externals: {
'./dist/server/main': 'require("./server/main")'
},
对于那些在使用Angular 8和Apollo For Graphql时遇到相同问题的人来说,这是一个迁移指南,它让我的灵魂得到了一些启示:在SSR模式下使用Apollo Angular时,我似乎也遇到了同样的问题。你在Edgaras Karka解决了吗?