Skip to content

Commit 9913d8e

Browse files
mfikesdnolen
authored andcommitted
CLJS-2708: Windows. ClojureScript fails to compile when node.js module is required
1 parent 9efb91b commit 9913d8e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/main/cljs/cljs/module_deps.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// NOTE: This code should only employ single quotes for strings.
2+
// If double quotes are used, then when the contents of this file
3+
// are passed to node via --eval on Windows, the double quotes
4+
// will be elided, leading to syntactically incorrect JavaScript.
5+
16
let fs = require('fs');
27
let path = require('path');
38
let mdeps = require('@cljs-oss/module-deps');
@@ -82,7 +87,7 @@ let md = mdeps({
8287
},
8388
filter: function (id) {
8489
return !(target === 'nodejs' && nodeResolve.isCore(id)) &&
85-
!id.startsWith("goog:");
90+
!id.startsWith('goog:');
8691
},
8792
detect: function (src) {
8893
let deps = getDeps(src);

src/main/clojure/cljs/closure.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2348,8 +2348,12 @@
23482348
(when env/*compiler*
23492349
(:options @env/*compiler*))))
23502350
([{:keys [file]} {:keys [target] :as opts}]
2351+
;; NOTE: The code value should only employ single quotes for strings.
2352+
;; If double quotes are used, then when the contents of this file
2353+
;; are passed to node via --eval on Windows, the double quotes
2354+
;; will be elided, leading to syntactically incorrect JavaScript.
23512355
(let [main-entries (str "[" (->> (package-json-entries opts)
2352-
(map #(str "\"" % "\""))
2356+
(map #(str "'" % "'"))
23532357
(string/join ",")) "]")
23542358
code (-> (slurp (io/resource "cljs/module_deps.js"))
23552359
(string/replace "JS_FILE" (string/replace file "\\" "\\\\"))

0 commit comments

Comments
 (0)