cljsjs

juhoteperi 2016-09-05T12:12:12.000066Z

@flyboarder Is browserify absolutely required for codemirror? Couldn't you write deps.cljs entries with proper requires for each addon so they depend on each other correctly

juhoteperi 2016-09-05T12:12:36.000067Z

With browserify we would need to include all files instead of just those needed by the app

flyboarder 2016-09-05T15:18:36.000073Z

@juhoteperi: there are some packages which require the standalone build option from browserify otherwise they attempt to load things at runtime via require, anyway we can get browserify as a cljsjs task?

flyboarder 2016-09-05T16:03:58.000074Z

@juhoteperi: I'm not sure I understand what you mean by include all the files?

juhoteperi 2016-09-05T16:05:45.000077Z

@flyboarder The bundle created by browserify contains all the addons, instead of just those used by the app

juhoteperi 2016-09-05T16:06:13.000078Z

BUT, if the addons are indeed CommonJS modules and use require we do indeed need to use browserify (for now)

flyboarder 2016-09-05T16:07:15.000081Z

@juhoteperi i see, can we put packaged (browserified) files in with cljsjs?

juhoteperi 2016-09-05T16:07:26.000082Z

Yes, there are several packages that do that

juhoteperi 2016-09-05T16:07:57.000083Z

does the project have existing browserify config?

juhoteperi 2016-09-05T16:08:09.000084Z

At least I'm quite sure some existing packages do that

flyboarder 2016-09-05T16:08:09.000085Z

no which is part of the problem šŸ˜•

flyboarder 2016-09-05T16:08:29.000086Z

browser ready packages are not available from the vendor lib

juhoteperi 2016-09-05T16:08:31.000088Z

Material-ui uses webpack, it is another package without included configuration

sherbondy 2016-09-05T20:57:16.000108Z

any pros at cljsjs-ifying packages have some helpful hints for wrapping up a complex library such as https://github.com/oliviertassinari/react-swipeable-views ?

sherbondy 2016-09-05T20:58:10.000110Z

Iā€™m guessing itā€™ll involve something along the lines of what is described here: http://krasimirtsonev.com/blog/article/distributing-react-components-babel-browserify-webpack-uglifyjs

sherbondy 2016-09-05T20:58:59.000112Z

e.g. using browserify or something to pull in a build of the library with all of its dependencies but exclude, e.g. React and shim it as a global?

martinklepsch 2016-09-05T21:17:47.000113Z

@sherbondy there usually is some build task to build a single js file. Have you tried running npm build in the root of that project?

martinklepsch 2016-09-05T21:18:08.000114Z

@sherbondy I just wanted to give it a try but my NPM stuff is wrecked somehow šŸ˜•

sherbondy 2016-09-05T21:19:44.000115Z

@martinklepsch yeah, in this case it builds a lib directory and spits out a number of individual deps, all of which contain ā€œrequires"

sherbondy 2016-09-05T21:20:02.000116Z

@martinklepsch I had to run ā€œnpm run buildā€ for some reason

sherbondy 2016-09-05T21:20:52.000117Z

@martinklepsch Iā€™ve gotten closer since asking. I then took the resulting SwipeableViews.js file from lib and ran it through browserify

martinklepsch 2016-09-05T21:21:14.000118Z

right re: npm run build always forget šŸ™‚

sherbondy 2016-09-05T21:37:41.000119Z

@martinklepsch apparently babel changed the way is does dep exports so in my browserify standalone build the obj. is showing up at window.SwipeableViews.default instead of just window.SwipeableViews

sherbondy 2016-09-05T21:38:30.000120Z

Iā€™ve tried running through "JavaScript Externs Generatorā€ to gen extern.js but Iā€™m getting a ā€œNamespace SwipeableViews was not foundā€ issue, anybody have tips for inspecting what the externs generator is seeing?

sherbondy 2016-09-05T21:38:37.000121Z

https://github.com/jmmk/javascript-externs-generator

martinklepsch 2016-09-05T21:40:44.000123Z

@sherbondy if you open the console and check whats inside the global context that's pretty much what the generator sees

sherbondy 2016-09-05T21:55:06.000125Z

@martinklepsch oh sweet, got it working! At window.SwipableViews.default instead of just window.SwipeableViews, but still! Woohoo!

martinklepsch 2016-09-05T21:55:47.000126Z

@sherbondy šŸŽ‰