beejunk / universal-snowpack-example

Example universal Javascript app with no Webpack/Babel using Snowpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example universal JavaScript App using Snowpack V3

This is a To-Do application built with Snowpack and Preact. A live version can be found here:

The goal of this project is to provide an example application where no bundlers are used and minimal build steps are required. All source code is written exclusively in JavaScript, and component code is shared between server and client.

Features

  • Pages are rendered server-side, and all Preact component code is shared between the server and the client.
  • All code (including server code) uses ES Modules.
  • No bundlers are used, even for production code.
  • Minimal build steps required. Code is not minified for production.
  • All code is pure JavaScript. Babel is not used, and Preact combined with htm is used to build components without JSX.
  • Basic implementation of Next.js-like file system routing

See the comments in the code for more details on the implementation.

Caveats

The idea behind this example is to show how far you can go with as little JavaScript tooling as possible. For a real-world application, you'll want to at least minimize your code before deploying. Additionally, any large scale application should (for now) bundle its production code for performance reasons.

Fast refresh is not set up for this example.

Additional resources

See the Snowpack website for more details on the benefits of bundle-less development.

About

Example universal Javascript app with no Webpack/Babel using Snowpack


Languages

Language:JavaScript 100.0%