Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
must be hidden from closure to prevent it trying to rewrite
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns shadow.esm) | ||
|
||
;; workaround until we can tell the closure-compiler to not rewrite | ||
;; a dynamic import(). we just want to keep it as is to import "foreign" | ||
;; code dynamically at runtime. | ||
;; FIXME: can't use import as name apparantly? | ||
;; | ||
;; (ns foo (:require [shadow.esm :refer (import)])) | ||
;; (defn init [] | ||
;; (js/console.log (import "./b.js"))) | ||
;; ------------------------- ^------------------------------------------------------ | ||
;; Error in phase :compilation | ||
;; Arguments to import must be quoted. Offending spec: ./b.js at line 10 demo / esm/a.cljs | ||
;; -------------------------------------------------------------------------------- | ||
(defn dynamic-import | ||
"dynamic import(path) where path is relative to the :output-dir of the build" | ||
[what] | ||
(js/shadow_esm_import what)) |