diff --git a/docs/preprocessing.md b/docs/preprocessing.md
index fb92333d..5ea48dae 100644
--- a/docs/preprocessing.md
+++ b/docs/preprocessing.md
@@ -72,7 +72,6 @@ The following options can be passed to the preprocessor. None are required:
| `markupTagName` | `"template"` | `string` that sets the name of the tag `svelte-preprocess` looks for markup in custom languages.
i.e `markup` makes it possible to write your markup between `` tag. |
| `aliases` | `null` | A list of tuples `[alias: string, language: string]` that correlates an `alias` to a `language`
i.e `['cst', 'customLanguage']` means
`<... src="./file.cst">`
`<... lang="cst">`
`<... type="text/customLanguage">`
`<... type="application/customLanguage">`
are treated as `customLanguage`. |
| preserve | `[]` | A `string` list of languages/aliases that shouldn't pass through the preprocessor. (i.e `ld+json`) |
-| `defaults` | `{ markup: 'html', script: 'javascript', style: 'css' }` | An `object` that defines the default languages of your components.
i.e: `{ script: 'typescript' }` makes TypeScript the default language, removing the need of adding `lang="ts"` to `script` tags.
**Note: It is generally not recommended to use this setting because not all tooling is able to deal with it, resulting in for example broken syntax highlighting for SCSS.** |
| `sourceMap` | `false` | If `true`, `svelte-preprocess` generates sourcemap for every language that supports it. |
##### Configuring preprocessors
diff --git a/src/autoProcess.ts b/src/autoProcess.ts
index 44b6efec..fb6fa960 100644
--- a/src/autoProcess.ts
+++ b/src/autoProcess.ts
@@ -63,6 +63,13 @@ export function sveltePreprocess(
...defaults,
});
+ // todo: remove this on v5
+ if (defaults != null) {
+ console.warn(
+ '[svelte-preprocess] Deprecation notice: using the "defaults" option is no longer recommended and will be removed in the next major version. Instead, define the language being used explicitly via the lang attribute.\n\nSee https://github.com/sveltejs/svelte-preprocess/issues/362',
+ );
+ }
+
const transformers = rest as Transformers;
if (aliases?.length) {
diff --git a/src/types/index.ts b/src/types/index.ts
index dfaf53ec..58f21392 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -64,6 +64,7 @@ export type AutoPreprocessOptions = {
markupTagName?: string;
aliases?: Array<[string, string]>;
preserve?: string[];
+ /** @deprecated Don't use "defaults" anymore, define the language being used explicitly instead */
defaults?: {
markup?: string;
style?: string;