From 5c4d77d939b704df4aa20748b540ad414f6a2c00 Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 11 Oct 2021 23:55:50 +0800 Subject: [PATCH] chore: add docs --- site/content/docs/04-compile-time.md | 1 + src/compiler/compile/Component.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/site/content/docs/04-compile-time.md b/site/content/docs/04-compile-time.md index ed6977f81f..3dd59244cc 100644 --- a/site/content/docs/04-compile-time.md +++ b/site/content/docs/04-compile-time.md @@ -82,6 +82,7 @@ The following options can be passed to the compiler. None are required: | `loopGuardTimeout` | 0 | A `number` that tells Svelte to break the loop if it blocks the thread for more than `loopGuardTimeout` ms. This is useful to prevent infinite loops. **Only available when `dev: true`** | `preserveComments` | `false` | If `true`, your HTML comments will be preserved during server-side rendering. By default, they are stripped out. | `preserveWhitespace` | `false` | If `true`, whitespace inside and between elements is kept as you typed it, rather than removed or collapsed to a single space where possible. +| `enableSourcemap` | `boolean | 'js' | 'css'` | If `true`, Svelte generate sourcemaps for components. Use `js` or `css` for more granular control of sourcemap generation. By default, this is `true`. | `outputFilename` | `null` | A `string` used for your JavaScript sourcemap. | `cssOutputFilename` | `null` | A `string` used for your CSS sourcemap. | `sveltePath` | `"svelte"` | The location of the `svelte` package. Any imports from `svelte` or `svelte/[module]` will be modified accordingly. diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 346c1a869b..885c3391e4 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -343,7 +343,7 @@ export default class Component { ? { code: null, map: null } : result.css; - const jsSourcemapEnabled = compile_options.enableSourcemap === true || compile_options.enableSourcemap === 'js' + const jsSourcemapEnabled = compile_options.enableSourcemap === true || compile_options.enableSourcemap === 'js'; if (!jsSourcemapEnabled) { js = print(program); @@ -352,7 +352,7 @@ export default class Component { const sourcemap_source_filename = get_sourcemap_source_filename(compile_options); js = print(program, { - sourceMapSource: sourcemap_source_filename, + sourceMapSource: sourcemap_source_filename }); js.map.sources = [