In Javascript when a module is required you can omit the extension in the relative path form. If you do and the path is a directory and that directory contains an index.js
, that file is treated as the main script.
So, this statement:
`
javascript
const foo = require('./foo')
`
Can be resolved as ./foo.js
or ./foo/index.js
.
The module resolver should take this into account, and if an index.js
is resolved in a required directory, it should also provide like both
module$Users$user$Documents$project$node_modules$foo$index
module$Users$user$Documents$project$node_modules$foo
Actual repr here: (link: cljs-name-to-path-issue)(https://github.com/rangeoshun/cljs-name-to-path-issue)
It produced the following error in browser:
Undefined nameToPath for module$Users$range$Documents$cljs_name_to_path_issue$node_modules$deat_mui_core$colors
It is because node_modules/deat-mui-core/colors/index.js
only provides the following in the compiled version:
`
javascript
goog.provide("module$Users$range$Documents$cljs_name_to_path_issue$node_modules$deat_mui_core$colors$index");
`
It should also provide if that makes no confilct:
`
javascript
goog.provide("module$Users$range$Documents$cljs_name_to_path_issue$node_modules$deat_mui_core$colors");
`