-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add preprocess to the adapter-static code example #8811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Without preprocess you get "unexpected token" errors when importing types, as described here: https://stackoverflow.com/questions/72846408/sveltekit-typescript-parse-error-when-importing-types/72846510#72846510
|
@@ -14,8 +14,10 @@ Install with `npm i -D @sveltejs/adapter-static`, then add the adapter to your ` | |||
// @errors: 2307 | |||
/// file: svelte.config.js | |||
import adapter from '@sveltejs/adapter-static'; | |||
import preprocess from 'svelte-preprocess'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should use vitePreprocess
here to be in line with the starter template
Which example are you referring to specifically? I don't think we have any snippet that necessitates a preprocessor on that page. |
https://kit.svelte.dev/docs/adapter-static#usage |
I think the problem is that people just copy this verbatim without knowing that they might to adjust things if they are using a preprocessor, and then getting confused by that. |
The example configs differ quite a bit already from what's in the templates, showing a diff would likely be more helpful for highlighting the relevant changes, but even then the snippet says the values there are default options so wouldn't really expect people to be copying it |
I think it would be good enough to have a comment that mentions the preprocess. |
Thanks for the PR but I'm against this change — as has been pointed out, it's just as likely that people will add an unwanted preprocessor as that they'll remove one they need. Adding something irrelevant to the code sample just obscures the bit we need to communicate. If developers blindly copy and paste code, errors like this one will be the least of the problems caused! We could argue that the error message itself should be more informative in this case, but that's a separate conversation |
Without preprocess you get "unexpected token" errors when importing types, as described here: https://stackoverflow.com/questions/72846408/sveltekit-typescript-parse-error-when-importing-types/72846510#72846510
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.