ClojureScript 包含 polyfill
ClojureScript include polyfill
我想在我的 ClojureScript 应用程序中包含一个 polyfill(具体来说,EventSource polyfill)。
我想在我的 leiningen 个人资料中添加它:
:foreign-libs [{:file "https://github.com/Yaffle/EventSource/blob/master/eventsource.min.js"
:provides ["what.namespace.should.i.put.here"]}]
但是这个 polyfill 不提供任何命名空间(它是一个 polyfill,而不是一个库)。将命名空间留空可以吗?它还会包含 polyfill 吗?
为了将 polyfill 包含在构建中,foreign-libs
声明应该提供至少一个模块的命名空间 和 ns
应该 :require
相同的命名空间。
在简单优化下,您可以查看生成的 :output-to js 文件以验证文件是否已正确包含,可能在输出的早期,除非 foreign-libs 声明指定命名空间依赖项。
我想在我的 ClojureScript 应用程序中包含一个 polyfill(具体来说,EventSource polyfill)。
我想在我的 leiningen 个人资料中添加它:
:foreign-libs [{:file "https://github.com/Yaffle/EventSource/blob/master/eventsource.min.js"
:provides ["what.namespace.should.i.put.here"]}]
但是这个 polyfill 不提供任何命名空间(它是一个 polyfill,而不是一个库)。将命名空间留空可以吗?它还会包含 polyfill 吗?
为了将 polyfill 包含在构建中,foreign-libs
声明应该提供至少一个模块的命名空间 和 ns
应该 :require
相同的命名空间。
在简单优化下,您可以查看生成的 :output-to js 文件以验证文件是否已正确包含,可能在输出的早期,除非 foreign-libs 声明指定命名空间依赖项。