Skip to content
Browse files

only use absolute paths in npm, not replacing links

  • Loading branch information
thheller committed Aug 28, 2018
1 parent 5bcb83f commit d59b91d5dbc83a1b2b9147a3f55d3fd38077f099
Showing with 15 additions and 6 deletions.
  1. +15 −6 src/main/shadow/build/npm.clj
@@ -34,6 +34,15 @@
(defn service? [x]
(and (map? x) (::service x)))

(defn absolute-file
".getCanonicalFile resolves links but we just want to replace . and .."
^File [^File x]
(-> x

(defn read-package-json
"this caches the contents package.json files since we may access them quite often when resolving deps"
[{:keys [index-ref] :as state} ^File file]
@@ -93,7 +102,7 @@
(when name
(let [file
(-> (io/file dir name)
(when (.exists file)

@@ -249,7 +258,7 @@
;; didn't even know that was allowed but node seems to resolve this
;; by looking at the package and picking the main
;; so we mimick that
(find-package-require npm (-> file (.getCanonicalFile) (.getName)))
(find-package-require npm (-> file (absolute-file) (.getName)))

@@ -586,7 +595,7 @@
(-> (if (and (= :release mode) (seq file-min))
(io/file file-min)
(io/file file))
(when-not (.exists file)
(throw (ex-info "file override for require doesn't exist" {:file file :require require :config cfg})))

@@ -645,7 +654,7 @@
(util/is-relative? override))
(let [override-file
(-> (io/file package-dir override)

(when-not (.exists override-file)
(throw (ex-info "override to file that doesn't exist"
@@ -713,12 +722,12 @@

(-> (io/file "")

(if (seq node-modules-dir)
(-> (io/file node-modules-dir)
(io/file project-dir "node_modules"))]

{::service true

0 comments on commit d59b91d

Please sign in to comment.
You can’t perform that action at this time.