Use modules from `web_modules` if present
Hey @yyx990803 thank you for putting this together, it will be super useful moving forward!
I was inspired by the idea to integrate support for snowpack
and gave an initial integration a try.
This assumes you have run npx snowpack
in the directory you're working on, so I'm not calling it an integration quite yet.
However, this supports having modules present in web_modules
and serving them as named packages directly from there. Quick example:
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>
<div>
Today's date is: {{ dayjs().format('dddd MMMM D, YYYY') }}
</div>
</template>
<script>
import dayjs from 'dayjs';
export default {
methods: {
dayjs
}
}
</script>
Then run:
$ npm init -y
$ npm i --save dayjs
$ npx snowpack
$ npx vite
I'm curious to hear what you think about this.