使用 Dart 'js' 进行模块化 js包裹
使用 dart interop js 包 我正在努力寻找一种使用多个 js 文件的方法(或者使用 CommonJS或 ES6 语法)。似乎只要在外部 js lib 文件中使用 import 语句,就会出现错误:
NoSuchMethodError:尝试调用非函数,例如 null: 'dart.global.someJsMethod'
当使用 @JS() 语法调用任何方法时,会抛出 。我尝试过使用 webpack 生成单个 js 文件,但错误仍然存在。
我是否只需接受这一点并手动合并到一个 js 文件中以删除所有 import 语句?或者我在飞镖参考资料中遗漏了一些秘方?
With the dart interop js package I am struggling to find a way of using multiple js files (either with CommonJS or ES6 syntax). It appears that as soon as an import statement is used within an external js lib file, an error:
NoSuchMethodError: tried to call a non-function, such as null:
'dart.global.someJsMethod'
is thrown when calling any methods with the @JS() syntax. I have tried using webpack to generate a single js file, but the error remains.
Do I just accept this and manually merge into one js file to get rid of all import statements? Or am I missing some secret sauce in my dart references?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论