@ -44,7 +44,7 @@ This is the Svelte compiler, which is primarily intended for authors of tooling
import * as svelte from 'svelte/compiler';
import * as svelte from 'svelte/compiler';
const { js, css } = svelte.compile(source, {
const { js, css } = svelte.compile(source, {
// the target module format – defaults to 'esm' (ES2015 modules), can also be 'cjs'
// the target module format – defaults to 'esm' (ES2015 module), can also be 'cjs' (CommonJS module)
format: 'cjs',
format: 'cjs',
// the filename of the source file, used in e.g. generating sourcemaps
// the filename of the source file, used in e.g. generating sourcemaps
@ -91,14 +91,14 @@ The Svelte compiler optionally takes a second argument, an object of configurati
| `immutable` | `boolean` | Whether to use object comparisons that assume immutability. This only affects components without `<svelte:options immutable={...}/>`, which has higher precedence than this option. | `false` |
| `immutable` | `boolean` | Whether to use object comparisons that assume immutability. This only affects components without `<svelte:options immutable={...}/>`, which has higher precedence than this option. | `false` |
| `legacy` | `boolean` | Ensures compatibility with very old browsers, at the cost of some extra code. | `false` |
| `legacy` | `boolean` | Ensures compatibility with very old browsers, at the cost of some extra code. | `false` |
| | | |
| | | |
| `preserveWhitespace` | `boolean` | TODO | `false` |
| `preserveWhitespace` | `boolean` | Whether to preserve multiple whitespace characters outside of a `<pre>`. | `false` |
| `preserveComments` | `boolean` | Include comments in rendering. Currently, only applies to SSR rendering. | `false` |
| `preserveComments` | `boolean` | Include comments in rendering. Currently, only applies to SSR rendering. | `false` |
| | | |
| | | |
| `format` | `'esm'`, `'cjs'` | The format to output in the compiled component.<br>`'esm'` - ES6/ES2015 module, suitable for consumption by a bundler<br>`'cjs'` - CommonJS module | `'esm'` |
| `format` | `'esm'`, `'cjs'` | The format to output in the compiled component.<br>`'esm'` - ES6/ES2015 module, suitable for consumption by a bundler<br>`'cjs'` - CommonJS module | `'esm'` |
| `name` | `string` | The name of the constructor in the compiled component. | `'SvelteComponent'` |
| `name` | `string` | The name of the constructor in the compiled component. | `'SvelteComponent'` |
| `filename` | `string` | The filename to use in sourcemaps and compiler error and warning messages. | `'SvelteComponent.html'` |
| `filename` | `string` | The filename to use in sourcemaps and compiler error and warning messages. | `'SvelteComponent.html'` |
| `outputFilename` | `string` | TODO | TODO |
| `outputFilename` | `string` | The filename to use in the generated sourcemap. | `null` |
| `cssOutputFilename` | `string` | TODO | TODO |
| `cssOutputFilename` | `string` | The filename to use in the generated CSS sourcemap. | `null` |
| `sveltePath` | `string` | The path to the root of the package used in `import`s generated by the compiler. | `'svelte'` |
| `sveltePath` | `string` | The path to the root of the package used in `import`s generated by the compiler. | `'svelte'` |