Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phaux/es-serve
Server for modern single-page web apps
https://github.com/phaux/es-serve
Last synced: 2 months ago
JSON representation
Server for modern single-page web apps
- Host: GitHub
- URL: https://github.com/phaux/es-serve
- Owner: phaux
- Archived: true
- Created: 2018-08-12T22:39:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-09T18:11:12.000Z (almost 6 years ago)
- Last Synced: 2024-10-10T12:40:38.554Z (3 months ago)
- Language: JavaScript
- Size: 99.6 KB
- Stars: 82
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - es-serve - Server for modern single-page web apps (JavaScript)
README
# PWA Serve
[![npm](https://img.shields.io/npm/v/pwa-serve.svg)](https://www.npmjs.com/package/pwa-serve)
Simple web server with babel compilation on the fly. In many cases it can be used as a replacement for webpack-dev-server or similar.
**Example usage**
```sh
pwa-serve --dir-map "dist=src" --watch "src" --watch "styles"
```## Features
- History API fallback (serve `index.html` for unknown routes).
- URL rewriting, useful for mapping your `dist` folder to `src`.
- Compiling scripts on the fly with babel (with cache). Simply add babel config to your project.
- Resolving bare imports via `babel-plugin-bare-import-rewrite` by default.
- Watch mode and auto-refresh (like browser-sync).## Options
- `--port` **number** -
Server port (default: 8000)- `--extensions` / `-e` **string** ... -
Specify additional extensions interpreted as JS (default: js, jsx, mjs, ts, tsx)- `--dir-map` / `-d` **key=value** ... -
Directory rewrite rules (e.g. `dist=src`)- `--ignore` / `-i` **string** ... -
Paths which will be omitted from compiling- `--verbose` / `-v` -
Verbose logging mode- `--watch` / `-w` **string** ... -
Enables watch mode and watches provided pathsOptions can be also provided via `server.config.json` (or `.toml`) file (format `opt_name`) or via environment variables (format `APP_OPT_NAME`)
## Non-goals
### Asset bundling
Browsers can't `import` styles nor images. If you want component-relative assets use `import.meta.url` and configure your bundler appropriately. If you need scoped CSS, use react's styled components or lit-html `` html`` ``.
### Hot module replacement
Too complicated
## Changelog
### `0.2.0`
- Initial version
### `0.2.1`
- Fix 404 on windows
- Search babel config relative to provided root path
- Send status text on error
- Strip ANSI color codes from errors