bazel_svelte_example Svelte Themes

Bazel_svelte_example

An simple example of how to build a Svelte app wtih Bazel.

Bazel Svelte Example

This repository houses an example of how to use Bazel to build a Svelte application.

It leverages rules_js, rules_ts, rules_esbuild, and rules_pkg to hermetically build and package the application.

Prerequisites

Install Bazel on your development machine.

Development

  1. Run bazel run //dev/server
  2. Navigate to localhost:8080

To enable live-reload run with Bazel watcher.

Build the app

  1. From within the repository run bazel build //:static_tar
  2. The resulting tar file will be located under bazel-bin/static_tar.tar relative to the directory root

Hold on, this doesn't look like a Svelte app!

This example is the bare-bones minimum to build a Svelte app. It does not contain any of the syntactic sugar such as +page.svelte provided by the Vite compiler in SvelteKit. This example compiles and bundles using esbuild instead.

For an example of how to use Vite check out https://github.com/mikberg/bazel-vite.

Top categories

Loading Svelte Themes