chore(examples): update typescript example

This commit is contained in:
Eric Liu 2020-09-13 12:36:12 -07:00
commit efbb61b646
9 changed files with 328 additions and 101 deletions

View file

@ -34,7 +34,7 @@ function serve() {
}
export default {
input: "src/main.ts",
input: "src/index.ts",
output: {
sourcemap: true,
format: "iife",
@ -43,41 +43,18 @@ export default {
},
plugins: [
svelte({
// enable run-time checks when not in production
dev: !production,
// we'll extract any component CSS out into
// a separate file - better for performance
css: (css) => {
css.write("public/build/bundle.css");
},
preprocess: sveltePreprocess(),
css: (css) => {
css.write("bundle.css");
},
}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ["svelte"],
}),
resolve({ browser: true, dedupe: ["svelte"] }),
commonjs(),
typescript({ sourceMap: !production }),
// In dev mode, call `npm run start` once
// the bundle has been generated
typescript({ sourceMap: !production, inlineSources: !production }),
!production && serve(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload("public"),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser(),
],
watch: {
clearScreen: false,
},
watch: { clearScreen: false },
};