Share a Vue component as a link, no build step
AI tools sometimes hand you a Vue component as a .vue file. Move it into one HTML file that loads Vue from a CDN, then upload it and send the link. No npm, no Vite.
A .vue file is a single-file component: a <template>, a <script> and a <style> block. Browsers cannot run it directly. Normally a build tool such as Vite compiles it, which means a project folder, npm and a deploy.
For one component you want someone to click through, a single HTML file is enough. Vue ships a browser build that compiles templates on the page.
The wrapper
Create a file called app.html and move the three blocks of your .vue file into it:
- ✓In the head, an import map pointing at the Vue browser build: <script type="importmap">{ "imports": { "vue": "https://unpkg.com/vue@3.5.44/dist/vue.esm-browser.prod.js" } }</script>
- ✓Copy the contents of the <style> block into a <style> tag in the head. Drop the scoped attribute; it only works through a build tool, so give the classes names that will not clash.
- ✓In the body, <div id="app"></div>, then a <script type="module">.
- ✓Inside it, start with import { createApp, ref, computed } from 'vue'; (whatever your component imports from vue).
- ✓Define the component as an object: const App = { setup() { ...your script code...; return { every value the template uses }; }, template: `...your template HTML...` };
- ✓Last line: createApp(App).mount('#app');
Converting <script setup>
Most AI-written components use <script setup>, where every top-level variable is available to the template automatically. In the wrapper, that code goes inside setup(), and setup() must return each variable and function the template uses.
Tested in Chrome with Vue 3.5.44: a list using v-for, a :class binding, @click handlers and a computed count rendered, and clicks updated the list and the count, both from a local file and over http.
If the page is blank
Three causes cover most blank pages:
- ✓Check the file name in the import map. vue.runtime.esm-browser.js has no template compiler: the page mounts empty and the console says runtime compilation is not supported in this build of Vue. Use vue.esm-browser.prod.js.
- ✓A value used in the template but missing from setup()'s return renders as nothing. The .prod.js file prints no warnings, so while debugging swap it for vue.esm-browser.js: the console then names the missing value ("was accessed during render but is not defined"). Add it to the return.
- ✓Imports from other packages need an import map entry each. For a multi-file project with its own package.json, build it to one file instead: sharing a Vite app as a single HTML file.
Upload it and send the link
Drag app.html onto the FileShare Pro dashboard and copy the link. Viewers need no account.
Turn on comments and reviewers can pin notes to parts of the page after typing a name. When you change the component, upload the new app.html over the old one and the link stays the same: updating a shared link without changing it.
Related: sharing a React component as a link and why an AI page works in chat but breaks when hosted.
Frequently asked
A .vue file needs to be compiled before a browser can run it. The wrapper above does that on the page with Vue's browser build.
No. The page loads Vue from a CDN, so you only need a text editor and a browser.
Yes. Double-click app.html; it runs from your computer the same way it runs at the link, as long as you are online for the CDN file.
Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.
Drop the file, copy the link — live in seconds, free plan included.
Start sharing free