我已经开始为一个cljs项目(src)使用:target :nodejs编译器选项。总的来说,它工作得很好。
但是,当尝试将@mapbox/react-native-mapbox-gl转换为更新的require语法时,例如
(:require [@mapbox/react-native-mapbox-gl])它失败了-
Library name must be specified as a symbol
因为npm模块的作用域是@。使用字符串也不起作用。
这是可行的-
(set! js/MapboxGL (js/require "@mapbox/react-native-mapbox-gl"))但是我很好奇是否有任何方法可以用require语法编译它。
发布于 2017-12-15 13:04:56
如果您使用1.9.854或更高版本,
您现在可以在以下位置使用字符串:require
(:require ["@mapbox/react-native-mapbox-gl" :as mapbox])希望您喜欢使用ClojureScript
https://stackoverflow.com/questions/47807439
复制相似问题