Fork me on GitHub
#cljsjs
<
2016-09-05
>
juhoteperi12:09:12

@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

juhoteperi12:09:36

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

flyboarder15:09:36

@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?

flyboarder16:09:58

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

juhoteperi16:09:45

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

juhoteperi16:09:13

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

flyboarder16:09:15

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

juhoteperi16:09:26

Yes, there are several packages that do that

juhoteperi16:09:57

does the project have existing browserify config?

juhoteperi16:09:09

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

flyboarder16:09:09

no which is part of the problem šŸ˜•

flyboarder16:09:29

browser ready packages are not available from the vendor lib

juhoteperi16:09:31

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

sherbondy20:09:16

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 ?

sherbondy20:09:10

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

sherbondy20:09:59

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?

martinklepsch21:09:47

@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?

martinklepsch21:09:08

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

sherbondy21:09:44

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

sherbondy21:09:02

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

sherbondy21:09:52

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

martinklepsch21:09:14

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

sherbondy21:09:41

@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

sherbondy21:09:30

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?

martinklepsch21:09:44

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

sherbondy21:09:06

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