FredKSchott / pika-pack

📦⚡️ Build your npm package using composable plugins. https://www.pika.dev/blog/introducing-pika-pack/
Other
2.31k stars 36 forks source link

Should I use `@pika/pack`? #91

Open jfrancos opened 3 years ago

jfrancos commented 3 years ago

Hi, big fan of Snowpack here. Thanks for your work on it.

The below link leads to a 404, and I wasn't sure where else to ask this question.

I'd like to publish a react-based module on NPM, and googling around, I see there's a few ways to package a module but no consensus for the best way to do it as far as I can tell. @pika/pack seems like a good way to go, especially since it seems to have the same creator as Snowpack, and Snowpack is great. But, it looks like @pika/pack hasn't been updated in two years.

It seems to now be hosted under snowpack's git repo. Maybe snowpack now has @pika/pack functionality? I don't see any docs that say how to use snowpack for that purpose though, and the docs on snowpack's @pika/pack page do still refer to e.g. npm install --dev @pika/pack.

Skypack's twitter page is called "Skypack (prev. pika)" so maybe it's skypack that has the functionality of @pika/pack that I'm looking for? But I don't see docs using skypack for that purpose.

What's the correct tool to use to compile/package a React component for publishing on NPM? Do I do that now with skypack, snowpack, @pika/pack, or something else?

To create a new issue or search existing discussions, start here:
👉 https://www.pika.dev/packages/@pika/pack/discuss 👈

All new issues created directly through GitHub will be closed.
Learn more: https://www.pika.dev/discussions

drwpow commented 3 years ago

Unfortunately there’s no good replacement for @pika/pack. It’s been unofficially put on the backburner just due to time constraints. Skypack is for serving npm packages straight to your browser (a play off of “cloud package“), but right now that tool doesn’t help you package & publish to npm.

We’ve talked about reinvesting in @pika/pack again in the future, but with all the changes to ESM / Node.js lately it’d probably be a rewrite, and we haven’t had time.

My personal recommendation is: if you use TypeScript to write your code, use tsc to compile both ESM & CommonJS bundles (example). If you don’t, Rollup is a little bit of setup but with all its built-in plugins and documentation it’s not too bad. I strongly recommend against webpack for npm (that’s more for browsers/client; not npm).

Of course, if you or anyone else you know really wants a tool to package npm packages again and would be willing to help, I’d be happy to chat about that too 🙂.

kysley commented 3 years ago

@drwpow I would love to see you guys commit more time to @pika/pack! It appears that tsdx is unmaintained so things are a little more difficult when you wanna start quick :)

jessekrubin commented 3 years ago

@kysley tsdx being abandoned frustrates me. I found a thing called rollpkg that you might be interest in.