Fork me on GitHub
#cljsjs
<
2016-03-14
>
asolovyov13:03:33

@juhoteperi: are there any tools to deal with packages which do var React = require('react');?

juhoteperi13:03:04

I think in most cases such packages can be compiled using browserify or such to "normal" JS

juhoteperi13:03:21

Usually packages provide some kind of build task to build browser compatible files

juhoteperi13:03:38

Also, ClojureScript has some support for converting CommonJS modules to Closure modules, but I don't know if that is yet usable and what would that require from other packages

asolovyov13:03:49

yeah, I'm not sure how to enable it...

asolovyov13:03:00

this react-input-mask has 'require' inside of a build file 😞

juhoteperi13:03:09

:module-type :commonjs on deps.cljs

juhoteperi13:03:30

But I don't know how it is supposed to map require calls to closure modules

asolovyov13:03:30

hm, I should try doing this somehow maybe...

juhoteperi13:03:26

Looks like react-input-mask only uses babel to compile ES6 to ES5 CommonJS module

juhoteperi13:03:32

A simple fix might be to remove the line with require call, React should already be available globally when you have :requires ["cljsjs.react"] on deps.cljs

asolovyov13:03:15

"remove the line" you mean just read the file, skip the line, write it back?

juhoteperi13:03:49

Something like it. Some package tasks are using regex to replace some parts of files.

asolovyov13:03:56

cool, thanks

asolovyov13:03:29

ah, replace-content, I see

juhoteperi13:03:50

Yeah it's provided by boot-cljsjs

asolovyov13:03:53

@juhoteperi: sorry for submitting previous takes, I should've checked better 😮