Skip to content

How to generate sourcemaps? #140

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

Closed
frederikhors opened this issue May 2, 2020 · 4 comments
Closed

How to generate sourcemaps? #140

frederikhors opened this issue May 2, 2020 · 4 comments

Comments

@frederikhors
Copy link
Contributor

frederikhors commented May 2, 2020

Hi @kaisermann, amazing project, thanks for your work!

In my Sapper project I have in rollup.config.js:

...
const preprocessOptions = {
  scss: { includePaths: ['src', 'node_modules'] },
  postcss: {
    plugins: [
      autoprefixer,
      !dev && cssnano
    ].filter(plugin => plugin)
  }
}
const preprocess = autoPreprocess(preprocessOptions)
const sourcemap = process.env.GENERATE_SOURCEMAP || config.client.output().sourcemap

export default {
  client: {
    input: config.client.input(),
    output: { ...config.client.output(), sourcemap },
    plugins: [
      ...
      svelte({
        dev,
        hydratable: true,
        emitCss: true,
        preprocess
      }),
...

This create a good css in __SAPPER__/build/main.[hash].css but I need sourcemaps.

Is there a way?

I think I can use the below but I think I'm wrong.

...
svelte({
  dev,
  hydratable: true,
  emitCss: true,
  css: css => css.write('dist/bundle.css', sourcemap), // <-- wrong directory and content
  preprocess
}),
...
@kaisermann
Copy link
Member

Het @frederikhors 👋 Currently, the svelte compiler doesn't handle any sourcemap generated by preprocessors. There's a PR by @halfnelson that will add support for sourcemap sometime in the future. Whenever it lands, I guarantee will be passing sourcemaps down the pipeline 😁.

@frederikhors
Copy link
Contributor Author

Please do not close this, as a remainder.

@kaisermann
Copy link
Member

@frederikhors Sourcemaps are already generated if you have the appropriate option configured for your preprocessor, and are returned to the compiler. Don't worry, I'll make sure to create some tests to guarantee they are being returned. However, for now, there's nothing more we can do from this side. Waiting for: sveltejs/svelte#5015.

@MingweiSamuel
Copy link

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

No branches or pull requests

3 participants