Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Feature: accept a source map object that the output source map will be based on #73

Open
ramasilveyra opened this issue May 14, 2017 · 1 comment

Comments

@ramasilveyra
Copy link

ramasilveyra commented May 14, 2017

Hello! Great work with butternut!

I was trying to add sourcemaps support to butternut-webpack-plugin (balthazar/butternut-webpack-plugin#2) but I dont know how to pass a sourcemap.

Maybe something like what babel does will be good:

babel.transform(input, {
  inputSourceMap
})

https://babeljs.io/docs/usage/api/#babel-transform-code-string-options-object-
https://babeljs.io/docs/usage/api/#options

Also Im not sure if this is the right place for this request, maybe it should be in https://github.com/Rich-Harris/magic-string ?

@Rich-Harris
Copy link
Owner

In general I feel that tools should not know anything about prior transformations — it means that every single step in a build pipeline has to reimplement the same logic, and insodoing significantly increases surface area for bugs.

For example, Rollup will compose sourcemaps from multiple chained transformer plugins without those plugins having to know anything about each other. Each plugin just describes the transformations it implements. I'd assumed that webpack would do something similar (cc @TheLarkInn!)

See also sorcery, which combines sourcemaps from multiple transformations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants