svelte-reactive-preprocessor icon indicating copy to clipboard operation
svelte-reactive-preprocessor copied to clipboard

Error when using sourcemap for reporting an error: Can't resolve original location of error.

Open BlueFoxPrime opened this issue 2 years ago • 6 comments

Hi,

unfortunately I can not get it to work. Any ideas?

(!) Error when using sourcemap for reporting an error: Can't resolve original location of error. src\entities\Task.svelte: (635:22) (!) Error when using sourcemap for reporting an error: Can't resolve original location of error. src\entities\Task.svelte: (663:5) (!) Error when using sourcemap for reporting an error: Can't resolve original location of error. src\entities\Task.svelte: (672:22) (!) Error when using sourcemap for reporting an error: Can't resolve original location of error. src\entities\Task.svelte: (700:5)

Let me know if you need further information. I am not sure what else to provide.

BlueFoxPrime avatar Dec 13 '22 16:12 BlueFoxPrime

Hi @BlueFoxPrime 👋

Did you include the preprocessor after other preprocessors? It can't deal with typescript for example, so make sure it's the last preprocessor

Feel free to include part of your config file, I'll take a look at it I don't have other ideas of where this could come from for now

Cheers

unlocomqx avatar Dec 13 '22 16:12 unlocomqx

@unlocomqx Thanks alot for the quick response! :) Year, I did just like in the docs... My rollup config looks like this:

`import svelte from 'rollup-plugin-svelte';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
import postcss from 'rollup-plugin-postcss';
const { reactivePreprocess } = require("svelte-reactive-preprocessor");

const production = !process.env.ROLLUP_WATCH;

export default {
    input: 'src/index.ts',
    output: {
        sourcemap: true,
        format: 'es',
        name: 'window',
        extend: true,
        dir: 'dist'
    },
    plugins: [
        svelte({
            dev: !production,
            emitCss: true,
            preprocess: [
                sveltePreprocess(),
                reactivePreprocess(),
            ],
        }),
        postcss(),
        resolve({ browser: true }),
        commonjs(),
        typescript(),
        production && uglify()
    ],
}`

BlueFoxPrime avatar Dec 13 '22 20:12 BlueFoxPrime

It was caused by the eval call that my preprocessor adds

You can suppress these warnings like this

Add to your rollup config

{
  // ....
  onwarn(warning, warn) {
    if (!production) {
      // suppress eval and sourcemap warnings
      if (warning.code === "EVAL" || warning.code === "SOURCEMAP_ERROR") {
        return
      }
    }
    warn(warning)
  }
}

Normally the warning SOURCEMAP_ERROR shouldn't be suppressed but I don't know how to manipulate the sourcemaps to fix the source of the issue

unlocomqx avatar Dec 13 '22 21:12 unlocomqx

@unlocomqx Thanks alot, that works. However, states do not show althought I run dev mode and have the state option enabled. I tried with chrome and firefox aswell. Any ideas on that too?

BlueFoxPrime avatar Dec 13 '22 23:12 BlueFoxPrime

Now I am having the following issue:

grafik

BlueFoxPrime avatar Dec 14 '22 19:12 BlueFoxPrime

I don't know how to reproduce this error but I made an attempt at fixing it Please try version 0.8.3 to see if it works Thanks

unlocomqx avatar Dec 14 '22 21:12 unlocomqx