Next generation frontend tooling. It's fast!
Go to file
2020-04-22 04:31:10 -04:00
.circleci ci 2020-04-21 01:21:12 -04:00
bin refactor: make createServer expose raw server 2020-04-21 22:32:57 -04:00
src fix: do not attempt rewrite on 304 2020-04-22 04:30:47 -04:00
test test: fix puppeteer on ci 2020-04-21 01:47:56 -04:00
.gitignore add tests 2020-04-20 20:57:21 -04:00
.prettierrc init 2020-04-20 04:00:10 -04:00
LICENSE refactor: use TS 2020-04-20 19:13:22 -04:00
package.json v0.3.1 2020-04-22 04:31:10 -04:00
README.md feat: support import rewriting in index.html 2020-04-21 18:06:55 -04:00
tsconfig.base.json refactor: make createServer expose raw server 2020-04-21 22:32:57 -04:00
yarn.lock add some caching 2020-04-22 03:09:53 -04:00

vite

No-bundle Dev Server for Vue Single-File Components

⚠️ Warning: Experimental ⚠️

Create the following files:

index.html

<div id="app"></div>
<script type="module">
import { createApp } from 'vue'
import Comp from './Comp.vue'

createApp(Comp).mount('#app')
</script>

Comp.vue

<template>
  <button @click="count++">{{ count }}</button>
</template>

<script>
export default {
  data: () => ({ count: 0 })
}
</script>

<style scoped>
button { color: red }
</style>

Then run:

npx vite

Go to http://localhost:3000, edit the .vue file to see changes hot-updated instantly.

How It Works

  • Imports are requested by the browser as native ES module imports - there's no bundling.

  • The server intercepts requests to *.vue files, compiles them on the fly, and sends them back as JavaScript.

  • Imports to npm packages inside .js files (and in <script> of index.html) are re-written on the fly to point to locally installed files (only packages that provide ES module builds will work - "module" field will be used if present in package.json). There is also plans to integrate with Snowpack to leverage its web_modules.

  • For libraries that provide ES modules builds that work in browsers, you can also directly import them from a CDN.

TODOs

  • SourceMap
  • Snowpack integration
  • Custom imports map support