In clojurescript 1.10.773 it is impossible to use eval
from cljs.js when I've bundled the project with webpack I think this is because eval
is calling find-ns-obj
, when doesn't work with the :bundle
:target
. That makes sense, but this error still occurs when an :ns
is passed in the options map.
Using eval
from cljs.js used to work in clojurescript 1.10.741, even when :target
was set to :bundle
. It looks like this is because previous versions of clojurescript never set *target*
when it was set in the compiler options.
The error I'm getting is:
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)
Any use of eval
, or eval-str
, compile-str
, etc. gives it to me. Say:
(eval-str (empty-state) "(+ 1 2)" "UNTITLED" {:eval js-eval} println)
And I get this error even if I provide my own :ns
.