@ -83,18 +82,24 @@ The Svelte compiler optionally takes a second argument, an object of configurati
|---|---|---|---|
|---|---|---|---|
| `generate` | `'dom'`, `'ssr'`, `false` | Whether to generate JavaScript code intended for use on the client (`'dom'`), or for use in server-side rendering (`'ssr'`). If `false`, component will be parsed and validated but no code will be emitted. | `'dom'` |
| `generate` | `'dom'`, `'ssr'`, `false` | Whether to generate JavaScript code intended for use on the client (`'dom'`), or for use in server-side rendering (`'ssr'`). If `false`, component will be parsed and validated but no code will be emitted. | `'dom'` |
| `dev` | `boolean` | Whether to enable run-time checks in the compiled component. These are helpful during development, but slow your component down. | `false` |
| `dev` | `boolean` | Whether to enable run-time checks in the compiled component. These are helpful during development, but slow your component down. | `false` |
| `customElement` | `boolean` | Whether to compile this component to a custom element. | `false` |
| `tag` | `string` | Overrides any `<svelte:options tag='...'/>` value specified by the component. | `null` |
| | | |
| `css` | `boolean` | Whether to include JavaScript code to inject your component's styles into the DOM. | `true` |
| `css` | `boolean` | Whether to include JavaScript code to inject your component's styles into the DOM. | `true` |
| `accessors` | `boolean` | Whether to include getters and setters for all props on the compiled component. This only affects components without `<svelte:options accessors={...}/>`, which has higher precedence than this option. | `false` |
| `hydratable` | `boolean` | Whether to support hydration on the compiled component. | `false` |
| `hydratable` | `boolean` | Whether to support hydration on the compiled component. | `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` |
| `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` |
| `customElement` | `boolean`, `{ tag, props }` | Whether to compile this component to a custom element. If `tag`/`props` are passed, compiles to a custom element and overrides the values exported by the component. | `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` |
| `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 |
| `cssOutputFilename` | `string` | TODO | TODO |
| `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'` |
| `preserveComments` | `boolean` | Include comments in rendering. Currently, only applies to SSR rendering. | `false` |