Typescript preprocessor for Svelte 3
Install
npm i svelte-ts-preprocess
Rollup config
import svelte from "rollup-plugin-svelte";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import { terser } from "rollup-plugin-terser";
import { preprocess } from "svelte-ts-preprocess";
const production = !process.env.ROLLUP_WATCH;
export default {
input: "src/main.js",
output: {
sourcemap: true,
format: "iife",
name: "app",
file: "public/bundle.js"
},
plugins: [
svelte({
dev: !production,
css: css => {
css.write("public/bundle.css");
},
preprocess: preprocess()
}),
resolve(),
commonjs(),
production && terser()
]
};
Quick starter template
svelte-ts-template
Typings
svelte-types