Use `dynamicCompileOptions` instead of `compilerOptions.runes` for `create`
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- nodejs, typescript
Research direction
Search the scaffolder's templates for the sveltekit({ compilerOptions: { runes: ... } }) block, which is the only code the payload names. Replace it with the dynamicCompileOptions form from the issue, and check whether the optional node:path sep change should also be made. Done when the generated project still forces runes for app code but not for node_modules, which you can confirm by scaffolding a project and inspecting its svelte.config.js.
Written by the indexing model from the issue text.
Description
As I was experimenting with the project scaffolder, I noticed I could steal that compilerOptions.runes trick to make sure runes are enforced in Svelte Changelog.
But while copying it and reading the docs, I noticed they mention Vite users (SvelteKit) should prefer dynamicCompileOptions. dynamicCompileOptions docs also provide an (outdated but) explicit example for that kind of check.
As a result, the template should probably be changed:
sveltekit({
// Force runes mode for the project, except for libraries. Can be removed in Svelte 6.
- compilerOptions: {
- runes: ({ filename }) =>
- filename.split(/[/\\]/).includes('node_modules') ? undefined : true
+ dynamicCompileOptions: ({ filename, compileOptions }) => {
+ if (!filename.split(/[/\\]/).includes('node_modules') && !compileOptions.runes) {
+ return { runes: true };
+ }
},
adapter: adapter()
})
Additionally, Node (and Bun) environments can take advantage of "node:path".sep instead of a (non-precompiled) regex, improving performance:
+import { sep } from 'node:path';
...
- if (!filename.split(/[/\\]/).includes('node_modules') && !compileOptions.runes) {
+ if (!filename.split(sep).includes('node_modules') && !compileOptions.runes) {
...
- Dominant language
- TypeScript
- Stars
- 513
- Forks
- 110
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sveltejs/cli
-
[bug] Better Auth addon generates legacy D1 binding access with SvelteKit 3 and Cloudflare adapter 8Openbug pkg:add
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sveltejs/cli#1450 · 2 comments ·
Maintainers usually reply within 4 days
-
pkg:add
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
sveltejs/cli#1404 · 1 comment ·
Maintainers usually reply within 4 days
-
pkg:add
Difficulty 1/5 Under an hour Newbie friendliness 78/100
sveltejs/cli#1399 · 2 comments ·
Maintainers usually reply within 4 days
-
pkg:migrate
Difficulty 3/5 1-2 days Newbie friendliness 35/100
sveltejs/cli#1461 · 2 comments ·
Maintainers usually reply within 4 days
-
enhancement pkg:migrate
Difficulty 3/5 1-2 days Newbie friendliness 53/100
sveltejs/cli#1440 · 3 comments · 1 reaction ·
Maintainers usually reply within 4 days
Similar issues
-
[analytics-core] getQueryParams does not decode `+` as space and truncates values containing `=`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
amplitude/Amplitude-TypeScript#2179 · 1 comment ·
Maintainers usually reply within 2 days
-
ci good first issue severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
TMHSDigital/GH-Arcade#111 ·
-
AsnIntegerConverter.toASN coerces strings with +value, rounding integers outside safe-integer rangeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PeculiarVentures/asn1-schema#189 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anaisbetts/spawn-rx#38 ·