Frequently Asked Questions
Sapper offers both Rollup and Webpack templates. If you don't have a strong reason to prefer one over the other, we'd recommend using the Rollup template. The Rollup implementation supports additional features such as improved tree-shaking for smaller bundles, TypeScript, the ability to serve a legacy bundle to older browsers, and it automatically lists all your
.css files in the
Link header to preload those files.
The Sapper template project with Rollup (see Getting started) can be converted to TypeScript by running:
You can also find a number of community templates that utilize TypeScript.
Before bundling your app, Sapper builds a special package for your app, which you can access by importing from
@sapper/app. Putting it inside
src/node_modules means that it won't get nuked when you add new dependencies, and that you can easily import from it using the Node resolution algorithm.
See also the Svelte FAQ for questions relating to Svelte directly.