Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

The hello-es6 example uses a directory to apply {{:module-type}} to every file in that directory.

{:file "src" :module-type :es6}

This leads to {{src/js/hello.js}} being aliased to the {{js.hello}} ns which .cljs files can then {{:require}}.

Given a directory structure like this:

{:file "lib-a" :module-type :es6}
{:file "lib-b" :module-type :es6}

├── lib-a
│   └── js
│       └── hello.js
├── lib-b
│   └── js
│       └── hello.js

Leads to {{lib-b}} silently replacing {{lib-a}} as they both claim the {{js.hello}} name.

The same issue is present in closure-compliant libs but they typically follow some kind of manual namespacing (ie. goog.string, cljs.core, ...) which ES6/JS libs do not do (and do not even support given their use of relative imports vs absolute imports)

Not sure how to handle this but at the very least there should be some kind of warning that there is a conflicting alias.

Demo here: https://github.com/thheller/hello-es6-conflict

1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/CLJS-1995 (reported by thheller)