developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8.06k stars 361 forks source link

Inline sourceMaps #810

Closed make-github-pseudonymous-again closed 3 years ago

make-github-pseudonymous-again commented 3 years ago

I have babel configured with inline sourceMaps using "sourceMaps": "inline". It works when I use babel instead of microbundle. You can see the config here: https://github.com/aureooms/set-alarm/blob/9f7f4900073af814016bed15fdea4cb90b0bb051/package.json#L33 Microbundle seems to ignore this choice. Is this a bug? Feature? Is there a case against inline source maps?

developit commented 3 years ago

Inline sourcemaps are generally not recommended because they increase bundle size and parse times. Some configurations remove them, but not all.

FWIW Microbundle isn't ignoring the babel config, it's using Rollup to produce bundles. Changing the babel config only changes the code string passed to Rollup, not the output.

We don't currently support inline sourcemaps because they are typically misused and a footgun. Do you have a compelling case that requires it?

make-github-pseudonymous-again commented 3 years ago

Do you have a compelling case that requires it?

None. I am holding on some old habits. I am open to change my behavior. I am curious because I thought having the source map inline simplifies development tools. I had overlooked the parsing time issue. And that alone should be enough not to use the maps inline. Even though these get stripped in production.

I imagine you also gain in development performance when you only load these maps when required. Not only parsing but also transfer time. Although in my case it happens locally so I do not care.

I think it is good that you do not support inline source maps. It prevented me from perpetuating a bad habit.

make-github-pseudonymous-again commented 3 years ago

Now I do remember why I had stuck with inline sourcemaps. It seems to be the only way to get accurate coverage reports with nyc/c8 and AVA. Not a problem since I can have a custom BABEL_ENV for that use case.

wardpeet commented 3 years ago

Thank you for opening this, @make-github-pseudonymous-again

We're marking this issue as answered and closing it for now but please feel free to reopen this and comment if you would like to continue this discussion. We hope we managed to help and thank you for using Microbundle!

Clemens-E commented 1 year ago

The only compelling reason is using it during development, inline source maps make it a lot easier if the rest of the application isn't designed to handle sourcemaps.