Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fun with sourcemaps #64

Open
Rich-Harris opened this issue May 5, 2015 · 1 comment
Open

More fun with sourcemaps #64

Rich-Harris opened this issue May 5, 2015 · 1 comment
Labels

Comments

@Rich-Harris
Copy link
Contributor

Automatic sourcemap flattening, introduced in 0.8, is great when it works. When it doesn't work, it's more of a nuisance than anything.

Two problems in particular have become fairly obvious:

  • It currently looks at all output files to try to flatten sourcemaps, when it should only really be looking at .js and .css files. (This became painfully clear when gobble tried to find sourcemap comments in several hundred megabytes of images...)
  • The trick of storing sourcemaps in memory, rather than with sourceMappingURL comments, doesn't work too well when sourcemap-generating transforms are mixed with non-sourcemap-generating transforms (such as merger nodes, .include() and other built-ins, gobble-derequire and so on), because sorcery can't find the sourcemap. Comments do at least persist across non-sourcemap-generating transform boundaries.

Am playing around with some fixes, all very WIP. Ironically the more I fight this stuff the more convinced I am that automatically flattening sourcemaps is the right thing to do - they're just such a massive pain to set up. Just need to concoct a medicine that isn't worse than the disease.

I suspect #63 is related as well.

@aubergene
Copy link

I'm confused as to conceptually what the plan is with sourcemaps. Following the instructions, I've made a straightforward plugin gobble-stylus which returns an object with a map property.

It says

The file, sources and sourcesContent properties of the sourcemap will be filled in by Gobble.

One of my main uses for Stylus is using @require to include other stylus files. Stylus correctly returns a sourcemap which lists the dependencies on the sources property, but when Gobble writes this to the .cache it has replaced sources with just the src path of the file it compiled, which then means sourcemaps don't map back to the original file. All this is even before sorcery gets involved. Could you enlighten me please?

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

No branches or pull requests

2 participants