Using {{npm-deps}} to specify a dependency on a library with {{es6}} modules causes errors in Google Closure, making the dependency unusable.
h3. Background
{{rc-time-picker}} comes as a set of {{es6}} modules in the {{es/}} subfolder as well as "traditional" {{module.exports}} in the {{lib/}} subdirectory. The {{package.json}} specifies both as {{module}} and {{main}} respectively (see
https://github.com/react-component/time-picker/blob/master/package.json).
Using this in a clojurescript build with {{npm-deps}} like the following makes google closure pick the {{es6}} part and later complain about the file mixing {{goog.provide}} and {{es6}} modules:
(require '[cljs.build.api :as b])
(b/build ["src/"]
{:main 'my.app
:output-to "js/app.js"
:optimizations :simple
:npm-deps {"react" "16.2.0",
"react-dom" "16.2.0",
"rc-time-picker" "^3.3.1",}
:install-deps true})
A simple {{app.cljs}} requiring {{"rc-time-picker" :as ...}} causes the following errors during compilation:
WARNING: WARNING - File cannot be a combination of goog.provide, goog.module, and/or ES6 module: .../out/node_modules/rc-time-picker/es/Combobox.js
...
ERROR: JSC_LANGUAGE_FEATURE. This language feature is only supported for ECMASCRIPT6 mode or better: modules. at ...out/node_modules/rc-time-picker/es/TimePicker.js line 12 :66
...
Specifying {{:language-in}} and {{:language-out}} doesn't help.
The error messages are caused by the Clojurescript code which copies the code from {{node_modules/rc-time-picker/es/}} to {{out/node_modules/rc-time-picker}} and where it adds various {{goog.provide}} statements to the top of the file, while the end of the file is a {{export default ...}} statement.