问题描述
我正在使用库 vtk.js。 VTK 有一个特殊的类设计(https://kitware.github.io/vtk-js/docs/develop_class.html)。当我编写一个类时,我需要导入 macro.js 模块,该模块公开了几个基本方法,例如 getter/setter/newInstance 等 (https://github.com/Kitware/vtk-js/blob/master/Sources/macro.js)。
看起来 CRA 对 macro.js 文件使用了一些特殊的加载器。尝试导入此类文件 (SyntaxError: Cannot use import statement outside a module
) 时出现错误。如果我将原始文件 macro.js 从 @kitware/vtk.js 复制到我的本地源文件夹,我仍然会收到错误消息。即使我删除了 macro.js 文件的所有内容,我也会收到错误 (The macro imported from "../macro" must be wrapped in "createMacro" which you can get from "babel-plugin-macros". Please refer to the documentation to see how to do this properly: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#writing-a-macro
)。但是,当我将 macro.js 重命名为 macro2.js 时,错误消失了。
有什么方法可以禁用这个宏加载器吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)