mirror of
https://github.com/preactjs/wmr.git
synced 2026-01-25 15:08:00 +00:00
WMR
Installation
npm i --save-dev wmr
## or
yarn add -D wmr
You can also use
npx wmr.
Setting up
First you'll need an index.html file containing your entry point, an example can be found in the demo app,
as you can see we have a script of type module that points to our js file.
Now we can add a script to our package.json to spin up the dev environment and one to build for production:
{
"scripts": {
"start": "wmr",
"build": "wmr build"
}
}
Features
- wmr is a single JavaScript file with no dependencies
import "deps"from npm without installation- Hot Module Replacement for JavaScript modules
- on-the-fly smart bundling of dependencies
- built-in JSX support without the overhead
- hot-reloading for CSS (both imports and
<link>tags) - import
*.module.cssfor CSS Modules - serves static files
- caches installed and built npm dependencies locally
- auto-populates
node_modulesprogressively based on usage wmr buildgenerates optimized bundles for production- no "entry points" or "pages" to configure
Hacking
git clone git@github.com:developit/wmr.git
cd wmr
npm i
# run the demo (no compile)
npm run demo
# build the single-file CLI:
npm run build
Languages
JavaScript
99.7%
HTML
0.2%
CSS
0.1%