We're updating the issue view to help you get more done. 

Possible conflict with automatic aliases for JS modules

Description

https://clojurescript.org/guides/javascript-modules

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

1 {: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:

1 2 3 4 5 6 7 8 9 10 {: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

Environment

None

Status

Assignee

Unassigned

Reporter

Thomas Heller

Labels

None

Approval

None

Patch

None

Priority

Minor