Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Provide a well lit path for typescript + sapper #1316

Closed
samccone opened this issue Jul 12, 2020 · 1 comment
Closed

Provide a well lit path for typescript + sapper #1316

samccone opened this issue Jul 12, 2020 · 1 comment

Comments

@samccone
Copy link
Contributor

background: In setting up a sapper project I needed to scrub many github issues and example repos to be able to create a setup which enabled me to author typescript in my project.

The goal of this issue would be to provide a well-lit-path for adding typescript to a sapper project that would be offered as a supported path when setting up a sapper project. I have outlined the changes I needed to make to accomplish this as follows:

Changes required to add typescript to a sapper project

Scope of the documentation

  1. enable users to author in typescript inside of .svelte files via <script type="text/typescript">
  2. enable users to import typescript into a svelte file (which will recompile on change).

Steps

package.json

+    "dev": "ROLLUP_WATCH=true sapper dev",
-    "dev": "sapper dev",
+ "typescript": "^3.9.6"
+ "@rollup/plugin-typescript": "^5.0.1",

rollup.config.js

+ import typescript from '@rollup/plugin-typescript'

in both client.plugins and server.plugins

+ typescript(),
@benmccann
Copy link
Member

I think we can close this as a duplicate of #760

enable users to author in typescript inside of .svelte files via <script type="text/typescript">

You can now set it just once at a project level with svelte-preprocessor 4.0.0 instead of on every script tag

enable users to import typescript into a svelte file (which will recompile on change).
"dev": "ROLLUP_WATCH=true sapper dev",

That's because of a bug in @rollup/plugin-typescript. You can upgrade to 5.0.2 and remove ROLLUP_WATCH=true

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants