Reputation: 33
I am completely new to Svelte and I am setting up a project for the first time. I want to use Svelte with Typescript so I follow the official guide (https://svelte.dev/blog/svelte-and-typescript) and run
npx degit sveltejs/template svelte-ts
cd svelte-ts
node scripts/setupTypeScript.js
npm install
However right out of the gate when running npm run dev
or npm run build
I get this error:
bundles src/main.ts → public\build\bundle.js...
[!] (plugin svelte) Error: Unrecognized option 'preprocess'
src\App.svelte
Error: Unrecognized option 'preprocess'
at C:\Users\teh\svelte-ts\node_modules\svelte\src\compiler\compile\index.ts:40:10
at Array.forEach (<anonymous>)
at validate_options (C:\Users\teh\svelte-ts\node_modules\svelte\src\compiler\compile\index.ts:34:23)
at compile (C:\Users\teh\svelte-ts\node_modules\svelte\src\compiler\compile\index.ts:75:2)
at Object.transform (C:\Users\teh\svelte-ts\node_modules\rollup-plugin-svelte\index.js:105:21)
at C:\Users\teh\svelte-ts\node_modules\rollup\dist\shared\rollup.js:18734:25
When inspecting the rollup.config.js
file of the Typescript project i noticed that the preprocess
property is a property of compilerOptions
:
plugins: [
svelte({
// enable run-time checks when not in production
compilerOptions: {
dev: !production,
preprocess: sveltePreprocess()
}
}),
...
but in the none-typescript project (https://github.com/sveltejs/svelte-preprocess#what-is-it) it is not.
So I moved it just outside the compilerOptions
and now it seems to build and serve just fin but I have no idea what the ramifications might be down the road.
Am I missing something or is there a bug in the template?
Upvotes: 1
Views: 2609
Reputation: 16411
Yes, it's a bug, reported here It has been fixed literally minutes after you posted this question though. So the new template works fine
Upvotes: 1