-
Notifications
You must be signed in to change notification settings - Fork 810
Getting sourceMap warnning when run npm run build
#174
Comments
By default, Svelte doesn't generate source maps in production mode, which will get you this warning. - typescript({ sourceMap: !production}),
+ typescript({ sourceMap: true }), |
So I must choose either a warning or a source map? There is no such choice like no warning and source map? |
I am interested in how to resolve this as well. Its great to have source maps with npm run dev. But, obviously having them on build isn't good. Is there a way to tweak svelte and/or typescript configurations to enable sourcemaps only on dev AND disable a warning on build? |
Same here, how to disable that annoying warning? |
I think it disappear if you put sourcemap: false in rollup's output. |
Hi @frederikhors , but how to disable Here is my config: ...
export default {
preserveEntrySignatures: false,
input: ["src/main.ts"],
output: {
sourcemap: !production,
format: "esm",
dir: buildDir,
// for performance, disabling filename hashing in development
chunkFileNames: `[name]${(production && "-[hash]") || ""}.js`,
},
plugins: [
svelte({
dev: !production, // run-time checks
// Extract component CSS — better performance
css: (css) => css.write(`bundle.css`),
hot: isNollup,
preprocess: sveltePreprocess({
sourceMap: !production,
postcss: true,
}),
}),
// resolve matching modules from current working directory
resolve({
browser: true,
dedupe: (importee) => !!importee.match(/svelte(\/|$)/),
}),
commonjs(),
typescript({
sourceMap: !production,
inlineSources: !production,
}),
... |
I stumbled upon this thread because I had the same problem when first initializing a ts project. |
When you build by running
The right solution to remove the warning on prod build would be, to add a dependecy to the environment.
That works for me. |
Using Typescript, based on this SO answer, seemingly this config does the job. The magic key is // ...
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
// ...
const production = !process.env.ROLLUP_WATCH;
// ...
export default {
// ...
output: {
sourcemap: !production,
// ...
},
plugins: [
svelte({
preprocess: sveltePreprocess({
sourceMap: !production
}),
compilerOptions: {
dev: !production,
enableSourcemap: false // Set to true if you want them
}
}),
// ...
typescript({
sourceMap: !production,
inlineSources: !production
}),
// ...
],
// ...
}; |
Just to clarify, The actual reason I came here too is that I stumpled accross that SO thread first as well because I have a Sveltekit project with typescript and I'd like to enable debugging inside VSCode for serverside code ( |
fresh project just cloned from repo, and ran typescript setup script.
Getting warning when run
npm run build
:Plugin typescript: @rollup/plugin-typescript: Typescript 'sourceMap' compiler option must be set to generate source maps.
checked that sourceMap is actually set to true in @tsconfig/svelte/tsconfig.json
The text was updated successfully, but these errors were encountered: