"config.kit.vite has been removed — use vite.config.js instead" error
Closed this issue · 11 comments
This is my repository https://github.com/stephane-klein/kit-docs-playground/tree/9049d03e2c84f6bf23b80559d26c1cdd57286a0d
When I execute:
$ npm install
I have this error:
$ npm install
npm WARN deprecated @types/lru-cache@7.10.10: This is a stub types definition. lru-cache provides its own type definitions, so you do not need this installed.
> mydocs@0.0.1 prepare
> svelte-kit sync
> config.kit.vite has been removed — use vite.config.js instead
at file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/chunks/error.js:565:10
at file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/chunks/error.js:457:43
at file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/chunks/error.js:443:18
at file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/chunks/error.js:443:18
at validate_config (file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/chunks/error.js:649:9)
at process_config (file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/chunks/error.js:626:20)
at load_config (file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/chunks/error.js:618:9)
at async file:///home/stephane/git/github.com/stephane-klein/kit-docs-playground/node_modules/@sveltejs/kit/dist/cli.js:48:19
npm ERR! code 1
npm ERR! path /home/stephane/git/github.com/stephane-klein/kit-docs-playground
npm ERR! command failed
npm ERR! command sh -c svelte-kit sync
npm ERR! A complete log of this run can be found in:
npm ERR! /home/stephane/.npm/_logs/2022-07-05T21_02_20_132Z-debug-0.log
How can I fix this error?
@mihar-22 any idea?
When you create a new project, vite.config.js should already be there.
You need to remove the vite configuration from svelte.config.js and move the plugins to vite.config.js instead.
Meaning your vite.config.js will look like this
import { sveltekit } from '@sveltejs/kit/vite';
import { kitDocsPlugin } from '@svelteness/kit-docs/node';
import Icons from 'unplugin-icons/vite';
/** @type {import('vite').UserConfig} */
const config = {
plugins: [
Icons({ compiler: 'svelte' }),
kitDocsPlugin({
shiki: {
theme: 'material-ocean',
},
}),
sveltekit(),
],
};
export default config;
and your svelte.config.js like this:
import adapter from '@sveltejs/adapter-auto';
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte', '.md'],
kit: {
adapter: adapter(),
prerender: {
default: true,
entries: ['*'],
},
},
};
export default config;
Meaning your vite.config.js will look like this
import { sveltekit } from '@sveltejs/kit/vite'; import { kitDocsPlugin } from '@svelteness/kit-docs/node'; import Icons from 'unplugin-icons/vite'; /** @type {import('vite').UserConfig} */ const config = { plugins: [ Icons({ compiler: 'svelte' }), kitDocsPlugin({ shiki: { theme: 'material-ocean', }, }), sveltekit(), ], };
This is my vite.config.js
content:
import { sveltekit } from '@sveltejs/kit/vite';
/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()]
};
export default config;
When you create a new project, vite.config.js should already be there.
@raymondmuller Why? Is it deliberate? Is this the desired operation of the command?
$ npm init @svelteness/kit-docs mydocs
✔ Default KitDocs Theme? (Y/n) · true
[kit-docs]: target directory is empty, creating new SvelteKit app.
create-svelte version 2.0.0-next.146
Welcome to SvelteKit!
This is beta software; expect bugs and missing features.
Problems? Open an issue on https://github.com/sveltejs/kit/issues if none exists already.
✔ Which Svelte app template? › SvelteKit demo app
✔ Add type checking with TypeScript? › Yes, using JavaScript with JSDoc comments
✔ Add ESLint for code linting? … No / Yes
✔ Add Prettier for code formatting? … No / Yes
✔ Add Playwright for browser testing? … No / Yes
Your project is ready!
✔ Type-checked JavaScript
https://www.typescriptlang.org/tsconfig#checkJs
Install community-maintained integrations:
https://github.com/svelte-add/svelte-adders
Next steps:
1: cd mydocs
2: npm install (or pnpm install, etc)
3: git init && git add -A && git commit -m "Initial commit" (optional)
4: npm run dev -- --open
To close the dev server, hit Ctrl-C
Stuck? Visit us at https://svelte.dev/chat
$ cd mydocs
$ npm install
npm WARN deprecated @types/lru-cache@7.10.10: This is a stub types definition. lru-cache provides its own type definitions, so you do not need this installed.
> mydocs@0.0.1 prepare
> svelte-kit sync
> config.kit.vite has been removed — use vite.config.js instead
at file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/chunks/error.js:565:10
at file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/chunks/error.js:457:43
at file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/chunks/error.js:443:18
at file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/chunks/error.js:443:18
at validate_config (file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/chunks/error.js:649:9)
at process_config (file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/chunks/error.js:626:20)
at load_config (file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/chunks/error.js:618:9)
at async file:///home/stephane/git/github.com/stephane-klein/mydocs/node_modules/@sveltejs/kit/dist/cli.js:48:19
npm ERR! code 1
npm ERR! path /home/stephane/git/github.com/stephane-klein/mydocs
npm ERR! command failed
npm ERR! command sh -c svelte-kit sync
npm ERR! A complete log of this run can be found in:
npm ERR! /home/stephane/.npm/_logs/2022-07-07T21_30_10_263Z-debug-0.log
I just posted this Reddit subject: https://old.reddit.com/r/sveltejs/comments/vtu5ha/do_you_have_an_idea_to_install_and_create_a/
@stephane-klein see https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md#patch-changes-2
A breaking change in SvelteKit.
Now, I pinned package version, with is my package.json
content:
{
"name": "mydocs",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"package": "svelte-kit package",
"preview": "vite preview",
"prepare": "svelte-kit sync"
},
"devDependencies": {
"@iconify-json/ri": "1.1.1",
"@sveltejs/adapter-auto": "1.0.0-next.34",
"@sveltejs/kit": "1.0.0-next.314",
"@svelteness/kit-docs": "0.22.12",
"clsx": "1.1.1",
"shiki": "0.10.1",
"svelte": "3.44.0",
"unplugin-icons": "0.13.4",
"vite": "2.9.13"
},
"type": "module"
}
Now, npm install
works with success.
I deleted vite.config.js
file.
Now, if I run npm run build
I have this error:
$ npm run build 130
> mydocs@0.0.1 build
> vite build
vite v2.9.13 building for production...
✓ 0 modules transformed.
Could not resolve entry module (index.html).
error during build:
Error: Could not resolve entry module (index.html).
at error (/home/stephane/git/github.com/stephane-klein/kit-docs-playground2/mydocs/node_modules/rollup/dist/shared/rollup.js:198:30)
at ModuleLoader.loadEntryModule (/home/stephane/git/github.com/stephane-klein/kit-docs-playground2/mydocs/node_modules/rollup/dist/shared/rollup.js:22527:20)
at async Promise.all (index 0)
Bug fixed in this changeset https://github.com/stephane-klein/kit-docs-playground/tree/1703f1a1f2e3b39f556704193d33475bd0ec8e94
@raymondmuller thank for your message 👍
The bug is always present if I follow https://kit-docs.svelteness.dev/docs/getting-started/quickstart#quick-installation
See this screencast: https://www.youtube.com/watch?v=P8oXwr3eKjU
I will try to create a Pull Requset to fix it.
The bug is always present if I follow https://kit-docs.svelteness.dev/docs/getting-started/quickstart#quick-installation
I don't understand why this bug is fixed only if I add @0.23.0
version:
npm init @svelteness/kit-docs@0.23.0 mydocs
🤔
This should be fixed in latest create package.
For anyone still getting this error I had to remove the vite
property and its values from the svelte.config.js
while also adding a vite.config.js
file. Both had to occur for it to work