Fork me on GitHub
#cljs-dev
<
2017-07-22
>
mitchelkuijpers16:07:38

I am trying out clojurescript master to test out the npm deps. Because we need to interface with certain external libraries for which we currently have a webpack build which we add to our clojurescript build which we would really like to get rid of. We have the following in npm-deps:

{"@atlaskit/navigation" "16.0.0"
 "@atlaskit/util-shared-styles" "^2.1.0"
 "prop-types" "^15.5.10"
 "react" "^15.4.2"
 "react-dom" "^15.4.2"
 "styled-components" "2.1.1"}
I am getting the following error while trying to require @atlaskit/navigation:
Uncaught Error: Undefined nameToPath for module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$es6_object_define_property

mitchelkuijpers16:07:11

Any idea what could cause this? I could also make repository with a minimal reproduction if that helps

mitchelkuijpers23:07:34

I created a small project to reproduce the error it seems the error comes from the styled-components library so this one tries to use that first and fails: https://github.com/mitchelkuijpers/cljs-atlaskit-node-modules

anmonteiro23:07:26

@mitchelkuijpers if you look in your out directory, my guess is that module can’t be processed by Closure

mitchelkuijpers23:07:31

I tried this in master btw

anmonteiro23:07:25

so you’ll see something weird under out/node_modules/core_js/library/modules/es6_object_define_property or something

mitchelkuijpers23:07:32

Is see some very weird filenames under out/node_modules/core_js/library/modules/

_add-to-unscopables.js  _enum-bug-keys.js                es6.object.set-prototype-of.js  _hide.js            _keyof.js            _object-gops.js           _shared.js        web.dom.iterable.js
_a-function.js          _enum-keys.js                    es6.object.to-string.js         _html.js            _library.js          _object-gpo.js            _shared-key.js    _wks-define.js
_an-object.js           es6.array.iterator.js            es6.string.iterator.js          _ie8-dom-define.js  _meta.js             _object-keys-internal.js  _string-at.js     _wks-ext.js
_array-includes.js      es6.object.assign.js             es6.symbol.js                   _iobject.js         _object-assign.js    _object-keys.js           _to-index.js      _wks.js
_cof.js                 es6.object.create.js             es7.symbol.async-iterator.js    _is-array.js        _object-create.js    _object-pie.js            _to-integer.js
_core.js                es6.object.define-properties.js  es7.symbol.observable.js        _is-object.js       _object-dp.js        _object-sap.js            _to-iobject.js
_ctx.js                 es6.object.define-property.js    _export.js                      _iterators.js       _object-dps.js       _property-desc.js         _to-length.js
_defined.js             es6.object.freeze.js             _fails.js                       _iter-create.js     _object-gopd.js      _redefine.js              _to-object.js
_descriptors.js         es6.object.get-prototype-of.js   _global.js                      _iter-define.js     _object-gopn-ext.js  _set-proto.js             _to-primitive.js
_dom-create.js          es6.object.keys.js               _has.js                         _iter-step.js       _object-gopn.js      _set-to-string-tag.js     _uid.js

mitchelkuijpers23:07:14

it seems to me the file is missing, but it created one with dots...:

'use strict';goog.require("module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_object_dp");goog.require("module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_descriptors");goog.require("module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_export");var $export=module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_export;module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_export(module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_export.S+
module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_export.F*!module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_descriptors,"Object",{defineProperty:module$home$mitchel$Development$atlas_crm_next$node_modules$core_js$library$modules$_object_dp.f})

mitchelkuijpers23:07:49

This might be stuff for which you need babel

mitchelkuijpers23:07:03

But not sure how to apply those to stuff you want to require from node_modules

martinklepsch23:07:19

Just a thought: It would be nice if the errors are clearly stating when a library can’t be processed. Otherwise people are gonna blame it on themselves and think they’re doing it wrong / that things are somehow not working for them or brittle.

martinklepsch23:07:58

Not sure how easy that would be to diagnose though.

anmonteiro23:07:44

exports are dynamic, Closure can’t figure out what that module exports

anmonteiro23:07:11

this kind of dynamic stuff is hardly ever going to work with Closure

mitchelkuijpers23:07:53

Hmm so I guess it will be very hard to use this stuff without a webpack build 😞

mitchelkuijpers23:07:07

thank you @anmonteiro then I'll stop trying