-
Notifications
You must be signed in to change notification settings - Fork 3
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
Pass sourcemap
option to the compiler.
#1
base: master
Are you sure you want to change the base?
Conversation
Sorry I missed this until now! I think adding sourcemap support for rollup is a great idea. Looking at the code, I think there's a simpler change that would also be more powerful. Basically, I think I goofed when I wrote this initially, in that the options should be passed on to the compiler. So if we just replace the line: return compiler.compile(code, { }); ... with ... return compiler.compile(code, options); Then sourcemaps should work. Thoughts? |
This was my original thought at first, then I found that when In addition, the rollup complains and fails to generate an output with |
Ah, got it, I'm catching up. Then how about something like: return compiler.compile(code, { sourcemap: options.sourcemap ? 'extract' : null }); BTW, I'm curious how the sourcemaps will work out with rollup. With webpack, they haven't been totally reliable, and I've never been able to figure out why not. |
I haven't encountered issues to generate sourcemap with rollup yet. It seems pretty reliable. And yes, it can be done in the way you advise, involving some adjustment in the output from the compiler. I am going to open up a PR in surplus repo. |
Hi Jason. I'd probably be more helpful if I actually pulled and built before throwing code change suggestions your way! Main concern with the code as is is that it calls the compiler twice. This doubles build times, but also relies on deterministic output from the compiler. That's currently true for surplus but hasn't always been and may not be so in the future. Compilers often have to do things like generate random symbols which might change run-to-run. What are the surplus changes you're thinking of? |
Sorry! I just check the newest commit in the Something like this should work (or similar modification on var out = compiler.compile(code, options);
return {code: out.src || out, map: out.map || ''}; ... and rollup will then complain about the graph in the comment in |
beep boop any update on this? :)
Sourcemaps themselves are a poorly designed spec, IMO. This doesn't surprise me 😅 That's also why minification + source maps is still currently pretty much impossible. At any rate, debugging Surplus in the browser right now is tricky due to poor sourcemap support. What changes need to be made in Surplus to fix this? |
To enable generating sourcemap with rollup.