在clojurescript 1.10.773中,当我在webpack打包项目时,无法使用从cljs.js的eval
,我认为这是因为我认为eval
调用了find-ns-obj
,但它不与:bundle
:target
一起使用。这说得通,但即使将:ns
传递到选项映射中,也会发生此错误。
在clojurescript 1.10.741中,即使将:target
设置为:bundle
,使用从cljs.js的eval
也曾经有效。这看起来是因为ClojureScript的前版本从未在编译器选项中设置*target*
。
我得到的错误是
core.cljs:11642 Uncaught Error: find-ns-obj not supported for target bundle
at Object.cljs$core$find_ns_obj [as find_ns_obj] (core.cljs:11642)
at Function.cljs$core$IFn$_invoke$arity$1 (core.cljs:11660)
at cljs$core$create_ns (core.cljs:11657)
at Function.cljs$js$compile_str_STAR__$_compile_loop (js.cljs:918)
at Function.cljs$core$IFn$_invoke$arity$3 (core.cljs:3918)
at Function.cljs$core$IFn$_invoke$arity$2 (core.cljs:3913)
at Function.cljs$core$IFn$_invoke$arity$2 (core.cljs:3948)
at core.cljs:10831
at Function.cljs$core$IFn$_invoke$arity$1 (core.cljs:10826)
at Function.cljs$core$IFn$_invoke$arity$variadic (core.cljs:10831)
cljs$core$find_ns_obj @ core.cljs:11642
(anonymous) @ core.cljs:11660
cljs$core$create_ns @ core.cljs:11657
cljs$js$compile_str_STAR__$_compile_loop @ js.cljs:918
(anonymous) @ core.cljs:3918
(anonymous) @ core.cljs:3913
(anonymous) @ core.cljs:3948
(anonymous) @ core.cljs:10831
(anonymous) @ core.cljs:10826
(anonymous) @ core.cljs:10831
cljs$core$trampoline @ core.cljs:10817
cljs$js$compile_str_STAR_ @ js.cljs:910
(anonymous) @ js.cljs:1019
cljs$js$compile_str @ js.cljs:968
interactive_syntax$core$eval_str @ core.cljs:48
run @ core.cljs:351
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:306
executeDispatch @ react-dom.development.js:389
executeDispatchesInOrder @ react-dom.development.js:414
executeDispatchesAndRelease @ react-dom.development.js:3278
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:3287
forEachAccumulated @ react-dom.development.js:3259
runEventsInBatch @ react-dom.development.js:3304
runExtractedPluginEventsInBatch @ react-dom.development.js:3514
handleTopLevel @ react-dom.development.js:3558
batchedEventUpdates$1 @ react-dom.development.js:21871
batchedEventUpdates @ react-dom.development.js:795
dispatchEventForLegacyPluginEventSystem @ react-dom.development.js:3568
attemptToDispatchEvent @ react-dom.development.js:4267
dispatchEvent @ react-dom.development.js:4189
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
discreteUpdates$1 @ react-dom.development.js:21887
discreteUpdates @ react-dom.development.js:806
dispatchDiscreteEvent @ react-dom.development.js:4168
Show 8 more frames
react-dom.development.js:327 Uncaught Error: find-ns-obj not supported for target bundle
at Object.cljs$core$find_ns_obj [as find_ns_obj] (core.cljs:11642)
at Function.cljs$core$IFn$_invoke$arity$1 (core.cljs:11660)
at cljs$core$create_ns (core.cljs:11657)
at Function.cljs$js$compile_str_STAR__$_compile_loop (js.cljs:918)
at Function.cljs$core$IFn$_invoke$arity$3 (core.cljs:3918)
at Function.cljs$core$IFn$_invoke$arity$2 (core.cljs:3913)
at Function.cljs$core$IFn$_invoke$arity$2 (core.cljs:3948)
at core.cljs:10831
at Function.cljs$core$IFn$_invoke$arity$1 (core.cljs:10826)
at Function.cljs$core$IFn$_invoke$arity$variadic (core.cljs:10831)
任何使用eval
、eval-str
、compile-str
等的操作都会给我。例如
(eval-str (empty-state) "(+ 1 2)" "UNTITLED" {:eval js-eval} println)
即使我提供了自己的:ns
,我也会得到这个错误。