klap icon indicating copy to clipboard operation
klap copied to clipboard

klap vs microbundle?

Open tleunen opened this issue 5 years ago • 7 comments

Looks like klap is in the same domain as microbundle. Would be nice to compare the 2?

tleunen avatar Jan 16 '20 14:01 tleunen

For me, personally

  • cleaner and more organized codebase
  • zero deps
  • different set of default babel and rollup plugins
  • microbundle supports Buble

tunnckoCore avatar Jan 17 '20 11:01 tunnckoCore

Let's add comparison section in readme. I'll keep this open in case someone gets there before me.

osdevisnot avatar Jan 17 '20 16:01 osdevisnot

@tunnckoCore it seems microbundle moved away from buble. Am I missing something?

osdevisnot avatar May 13 '20 19:05 osdevisnot

I did a quick comparison between klap, microbundle and tsdx. Here are notable differences:

:angel: Comparison with microbundle and tsdx

Feature klap microbundle tsdx
Typescript Support :white_check_mark: :white_check_mark: :white_check_mark:
No Dependencies :white_check_mark: :x: :x:
Scaffolding :white_check_mark: :x: :white_check_mark:
Dev Server :white_check_mark: :x: :x:
CSS :x: :white_check_mark: :white_check_mark:
CSS Modules :x: :white_check_mark: :x:
Build Constants :x: :white_check_mark: :white_check_mark:
Testing/Linting :x: :x: :white_check_mark:

We should probably start supporting build constants and some variation of CSS (maybe using postcss).

The testing/linting setup is not a primary goal for klap and we can skip it.

osdevisnot avatar May 13 '20 19:05 osdevisnot

Yup, true, they kind of moved to a hybrid approach as I remember.

Agree.

Build Constants

What do you mean with that? TSDX supports transforming such things, I think. :)

tunnckoCore avatar May 14 '20 00:05 tunnckoCore

Build constants are essentially constant variables that are pre-defined. Similar to process.env.NODE_ENV, but more granular.

For example, you can define a constant called DEBUG = true and use DEBUG in your library code when developing, maybe like this:

if(DEBUG){
	console.log('this was never supposed to happen')
}

Then you just run the build for distribution with DEBUG = false and all your code within the if block get's removed.

Another use case is when you want to create multiple versions of your library with certain features on/off based on a defined build constant.

osdevisnot avatar May 14 '20 02:05 osdevisnot

Exactly. TSDX does this. Dev expressions, node_env and etc, also uses the replace plugin, so.. probably possible to customize further.

tunnckoCore avatar May 14 '20 06:05 tunnckoCore