typescript@4.4 or greater breaks build command
Theo-Steiner opened this issue · comments
Hello everyone,
somebody in the discord had issues with getting svelte to build after setting up the default template the recommended way.
I could produce his troubles with this process:
npx degit sveltejs/template test
cd test
node scripts/setupTypeScript.js
npm install
npm run build
the build command neither errors out nor finishes, and instead just gets stuck.
after some tinkering I found out that this could be fixed by installing an earlier version of typescript.
npm install typescript@4.3.5
is the last version that leaves the build command unbroken.
as this is the recommended way to set up typescript, I think this is quite a severe problem, as for some users this might be their first encounter with svelte and could leave a bad first impression.
Seems to be an upstream issue with @rollup/plugin-typescript
: rollup/plugins#983
It's actually an upstream issue with typescript
, which was fixed a few hours ago. Once 4.4.3 is released we can revert the workaround.
The typescript version 4.3.5 in the script is making npm unable to resolve dependency versions as you could see here :
$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: svelte-app@1.0.0
npm ERR! Found: typescript@4.3.5
npm ERR! node_modules/typescript
npm ERR! dev typescript@"4.3.5" from the root project
npm ERR! peer typescript@">=2.7" from ts-node@10.2.1
npm ERR! node_modules/ts-node
npm ERR! peerOptional ts-node@">=9.0.0" from postcss-load-config@3.1.0
npm ERR! node_modules/postcss-load-config
npm ERR! peerOptional postcss-load-config@"^2.1.0 || ^3.0.0" from svelte-preprocess@4.9.1
npm ERR! node_modules/svelte-preprocess
npm ERR! dev svelte-preprocess@"^4.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^4.4.2" from svelte-preprocess@4.9.1
npm ERR! node_modules/svelte-preprocess
npm ERR! dev svelte-preprocess@"^4.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/etienne/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/etienne/.npm/_logs/2021-09-06T17_09_27_491Z-debug.log
@kaisermann Did svelte-preprocess bump its peerdep on TypeScript without marking it as a breaking change?
Yes, peerDependencies
was bumped to require 4.4.2 or greater, but I don't see a reason why.
That's an error from my part, will fix later today 🙈
Fixed on 4.9.2
@dummdidumm dummdidumm reopened this 5 hours ago
@dummdidumm Is the issue still happening 👀 ?
Tried locally:
The template currently pins TypeScript 4.3.5, because of this issue with the latest 4.4. Once 4.4.3 is released, we can undo the pin and close this issue.
The problem with svelte-preprocess's peerdep on TypeScript was an unrelated issue that prevented the workaround currently in place for this issue from working.