svelte-reactive-preprocessor
svelte-reactive-preprocessor copied to clipboard
Error when using sourcemap for reporting an error: Can't resolve original location of error.
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.
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 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()
],
}`
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 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?
Now I am having the following issue:

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