Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fwilkerson/microenvi

Bundle, serve, and hot reload with one command
https://github.com/fwilkerson/microenvi

micro microbundle

Last synced: 3 months ago
JSON representation

Bundle, serve, and hot reload with one command

Awesome Lists containing this project

README

        

# microenvi

Microenvi is a zero configuration micro development environment. Bundle, serve, and hot reload with one command.

Transpile & bundle is done with [microbundle](https://github.com/developit/microbundle).

## Quick start

A simple hello world with microenvi and preact;

- first let's initialize our project `npm init --yes`
- then install preact `npm i -S preact`
- finally install microenvi `npm i -D microenvi`

Now add the following to your package.json

```json
{
"main": "public/static/bundle.mjs",
"scripts": {
"dev": "microenvi"
}
}
```

Create a `public` folder and add the following `index.html` to it.

```html




Microenvi



```

Finally create a `src` folder and add the following `index.js` to it.

```javascript
import {h, render} from 'preact';

render(

Hello, Microenvi

, document.getElementById('root'));
```

Start your dev environment by running... `npm run dev`

## CLI Options

```
Usage
$ microenvi [options]

Available Commands
watch Bundle, serve, and reload

For more info, run any command with the `--help` flag
$ microenvi watch --help

Options
-v, --version Displays current version
--cwd Use an alternative working directory (default .)
--dir Specify the directory to watch (default public)
--external Specify external dependencies (default none)
--globals Specify global dependencies (default none)
--jsx A custom JSX pragma like React.createElement (default h)
--define Inline constants (default none)
--alias Remap imports from one module to another (default none)
--open Automatically open browser (default true)
--port Specify a port (default 3000)
--single Serve single page app (default false)
--ws Specify a port for the reload ws (default 3301)
-h, --help Displays this message
```

The syntax for `--define` and `--alias` are as follows:

```bash
$ microenvi --define process.env.NODE_ENV=production,NUM=123,BOOL=true
# and
$ microenvi --alias react=preact-compat,react-dom=preact-compat
```