kit
kit copied to clipboard
feat: enable extending user tsconfig
Closes https://github.com/sveltejs/kit/issues/6868 by allowing the user to specify a root tsconfig to extend. This is useful for monorepos where the is a base tsconfig file at the root that needs to be extended.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [ ] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.
Tests
- [ ] Run the tests with
pnpm testand lint the project withpnpm lintandpnpm check
Changesets
- [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running
pnpm changesetand following the prompts. All changesets should bepatchuntil SvelteKit 1.0
🦋 Changeset detected
Latest commit: d8b6e16e9faa3fb7f679253330e5ccc352c063ad
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @sveltejs/kit | Minor |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@robBowes is attempting to deploy a commit to the Svelte Team on Vercel.
A member of the Team first needs to authorize it.
Thank you. extends probably isn't the right name — it should be something tsconfig-specific.
I wonder if a more future-proof approach might be to allow the generated config to be augmented in arbitrary ways? Something like this:
// svelte.config.js
import path from 'path';
export const config = {
kit: {
tsconfig: (tsconfig) => {
tsconfig.extends = path.resolve('../tsconfig.json');
}
}
};
Or this:
// svelte.config.js
import path from 'path';
export const config = {
kit: {
tsconfig: (tsconfig) => {
return {
...tsconfig,
extends: path.resolve('../tsconfig.json')
};
}
}
};
I don't know if tsconfig is the best name for the option.
I like the second version of Rich's proposal. I think tsconfig is the right name.
going to close this in favour of #8606 which implements the idea above — thanks!