5 ms·
This link explains the new Webpack support in more detail: https://clojurescript.org/news/2020-04-24-bundle-target https://clojurescript.org/news/2020-04-24-bun
by drcode 6y ago
This link explains the new Webpack support in more detail: https://clojurescript.org/news/2020-04-24-bundle-target https://clojurescript.org/news/2020-04-24-bundle-target
Though that post is pretty good, I wish someone could create a more ELI5 version of the post for people who aren't knee-deep in javascript packaging systems. Can someone just answer some newb questions for me?
1. I know there's a website where people store javascript packages in "npm" which can be viewed here: https://www.npmjs.com/package/browse https://www.npmjs.com/package/browse. Does this new clojurescript functionality let me USE all those packages in clojurescript? What are the precise limitations? In what cases do I still want to use cljsjs? (another thing that is confusing to me, tbh)
2. Does this new clojurescript functionality let me CREATE new npm packages and put them on the main npm site? What is "webpack" exactly and how does it relate to npm? If so, what are the precise limitations?
I swear I know a fair amount of stuff on other programming subjects, I just have a blind spot when it comes to javascript packaging and packages, so this info is really appreciated!
- swannodette 6y ago1. NPM is analogous to Maven for Java. Yes the ClojureScript bundler target lets you use anything you've installed from NPM into your project's `node_modules` directory. Not many limitations because we wash our hands of dealing with this stuff - use whatever popular bundler solution you prefer. 2. Not for creating NPM packages, just consuming them. Webpack lets you use dependencies from NPM and package them up into a single JS (or code-split) asset to be used on a webpage. Note, we have no integration to any particular bundler. You could just as easily run Metro for React Native on the output and build a mobile app.
- drcode 6y agoThanks, that clarifies things a lot!
- skybrian 6y agoCaveat: if you want your code to run in a web browser, you will need to be careful about which npm packages you use, since some are server-side only.
- cutler 6y agoHave you considered Parcel, going forward? It seems to be a lot lighter and easier than Webpack.
- swannodette 6y agoWe have no specific integration with Webpack, so you can consider anything since we haven't chosen for you :)
- deleted 6y ago[deleted]
- tekacs 6y agoThere's also a relatively straightforward guide to usage with Webpack here: https://clojurescript.org/guides/webpack https://clojurescript.org/guides/webpack
- simongray 6y ago> Does this new clojurescript functionality let me USE all those packages in clojurescript? What are the precise limitations? If you use Shadow CLJSs (all-in-one tool for ClojureScript), you've been able to use NPM packages directly for many years now. > Does this new clojurescript functionality let me CREATE new npm packages and put them on the main npm site? Shadow CLJS also lets you create NPM packages.
- capableweb 6y ago> If you use Shadow CLJSs (all-in-one tool for ClojureScript), you've been able to use NPM packages directly for many years now. That's not only true for Shadow CLJS but ClojureScript in general have allowed you to use npm packages for many years as well, although it was a bit clunky. Shadow CLJS did improve the developer experience though.