Skip to content

Commit 4039eff

Browse files
authored
(fix) always add fallback preprocessor (#255)
#243
1 parent 609315b commit 4039eff

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

packages/language-server/src/plugins/svelte/SveltePlugin.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -166,24 +166,21 @@ export class SveltePlugin
166166
}
167167

168168
private useFallbackPreprocessor(document: Document, foundConfig: boolean) {
169-
if (
169+
const needsConfig =
170170
document.styleInfo?.attributes.lang ||
171171
document.styleInfo?.attributes.type ||
172172
document.scriptInfo?.attributes.lang ||
173-
document.scriptInfo?.attributes.type
174-
) {
175-
Logger.log(
176-
(foundConfig
177-
? 'Found svelte.config.js but there was an error loading it. '
178-
: 'No svelte.config.js found but one is needed. ') +
179-
'Using https://github.com/sveltejs/svelte-preprocess as fallback',
180-
);
181-
return {
182-
preprocess: importSveltePreprocess(document.getFilePath() || '')({
183-
typescript: { transpileOnly: true },
184-
}),
185-
};
186-
}
187-
return {};
173+
document.scriptInfo?.attributes.type;
174+
Logger.log(
175+
(foundConfig
176+
? 'Found svelte.config.js but there was an error loading it. '
177+
: 'No svelte.config.js found' + (needsConfig ? ' but one is needed. ' : '. ')) +
178+
'Using https://github.com/sveltejs/svelte-preprocess as fallback',
179+
);
180+
return {
181+
preprocess: importSveltePreprocess(document.getFilePath() || '')({
182+
typescript: { transpileOnly: true },
183+
}),
184+
};
188185
}
189186
}

0 commit comments

Comments
 (0)