ccapture.js icon indicating copy to clipboard operation
ccapture.js copied to clipboard

Rewrite build scripts and introduce a bundler

Open marcofugaro opened this issue 5 years ago • 4 comments

Hey, I could contribute to this library and rewrite it using ES6 imports + rollup like three.js is doing.

This could be the "clean" way to fix #78.

Are you interested?

marcofugaro avatar Jun 18 '20 10:06 marcofugaro

Yes, please. I've been trying to understand the latest landscape on modules across browser and node and i'm even more confused than before. I nowadays only code ES6 modules, no npm dependencies. I've found that node 14 has ES6 imports, but then require doesn't work. So if anyone can draft what the best, most straightforward way of delivering libraries is, i'll be very thankful.

spite avatar Jun 18 '20 11:06 spite

Yes, please. I've been trying to understand the latest landscape on modules across browser and node and i'm even more confused than before.

😆

Sure! Do you prefer one big PR or multiple smaller PRs?

marcofugaro avatar Jun 18 '20 11:06 marcofugaro

Three.js is using ES6 imports, they aren't actually node 14 imports, they work in node only thanks to the rollup bundler, the most common bundler used for libraries (webpack and parcel are more for projects).

It is good practice to write a library using ES6 imports instead of requires if the library target is the browser, since they're supported natively. However the bundler takes the library code and puts it all together in a single umd (Universal Module Definition) file which works everywhere, node or browser.

If you want to read more: https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c

Hope I didn't confuse you even more. 😄

marcofugaro avatar Jun 18 '20 11:06 marcofugaro

So was any progress made? If not: Sprite, do you commit to reviewing and merging the PR(s) if Marcofugaro creates them? Marcofugaro, are you still willing to create the PR(s)? Is there anything else that either of you need?

philipswan avatar Jul 10 '22 20:07 philipswan