Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Polymer 3、apollo客户端、graphql和CommonJS模块_Polymer_Graphql_Apollo Client_Polymer 3.x_Lit Html - Fatal编程技术网

Polymer 3、apollo客户端、graphql和CommonJS模块

Polymer 3、apollo客户端、graphql和CommonJS模块,polymer,graphql,apollo-client,polymer-3.x,lit-html,Polymer,Graphql,Apollo Client,Polymer 3.x,Lit Html,亲爱的 我正在尝试使GraphQL与Polymer 3(或lit html)一起工作 尝试使用apollo客户端(它似乎有用于聚合元素和Light html的适配器)并遇到在聚合中导入CommonJS模块(即module.export)的问题: Uncaught SyntaxError: The requested module '../../graphql/language/visitor.js' does not provide an export named 'visit' 如果我错了,

亲爱的

我正在尝试使GraphQL与Polymer 3(或lit html)一起工作

尝试使用apollo客户端(它似乎有用于聚合元素和Light html的适配器)并遇到在聚合中导入CommonJS模块(即module.export)的问题:

Uncaught SyntaxError: The requested module '../../graphql/language/visitor.js' does not provide an export named 'visit'

如果我错了,请纠正我,但如果apollo客户提供了,这应该会起作用。我试图通过附带的指南来实现这一点,但没有成功。

如果您想通过ES模块导入语法加载commonjs模块,则必须使用构建时转换(例如,像webpack这样的捆绑程序)

Commonjs模块(
require(…)
exports.foo=…
)与ES模块非常不同,通常需要一些预处理才能在浏览器中加载