8000 feat: add rolldown support · unplugin/unplugin-vue@4e99b15 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e99b15

Browse files
committed
feat: add rolldown support
1 parent 3a4a4d1 commit 4e99b15

File tree

10 files changed

+281
-6
lines changed

10 files changed

+281
-6
lines changed

examples/rolldown/build.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @ts-check
2+
import process from 'node:process'
3+
import { rolldown } from 'rolldown'
4+
import Vue from 'unplugin-vue/rolldown'
5+
6+
const bundle = await rolldown({
7+
input: ['./src/main.ts'],
8+
external: ['vue'],
9+
plugins: [Vue()],
10+
})
11+
await bundle.write({
12+
dir: 'dist',
13+
format: 'esm',
14+
})
15+
process.exit(0)

examples/rolldown/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Rolldown</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="importmap">
12+
{
13+
"imports": {
14+
"vue": "https://unpkg.com/@vue/runtime-dom@3.2.27/dist/runtime-dom.esm-browser.js"
15+
}
16+
}
17+
</script>
18+
<script src="./dist/main.js" type="module"></script>
19+
</body>
20+
</html>

examples/rolldown/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"private": true,
3+
"type": "module",
4+
"author": "三咲智子 <sxzz@sxzz.moe>",
5+
"scripts": {
6+
"build": "node build.js",
7+
"preview": "serve"
8+
},
9+
"dependencies": {
10+
"vue": "^3.4.33"
11+
},
12+
"devDependencies": {
13+
"rolldown": "^0.12.2",
14+
"serve": "^14.2.3",
15+
"unplugin-vue": "workspace:*"
16+
}
17+
}

examples/rolldown/src/App.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
const msg = ref('')
4+
</script>
5+
6+
<template>
7+
<div>
8+
<h1>Hello world</h1>
9+
<h2>{{ msg }}</h2>
10+
<input v-model="msg" type="text" />
11+
</div>
12+
</template>

examples/rolldown/src/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
4+
createApp(App).mount('#app')

examples/rolldown/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"jsx": "preserve",
4+
"module": "esnext",
5+
"moduleResolution": "bundler"
6+
},
7+
"include": ["src/**/*", "*"],
8+
"exclude": ["node_modules"]
9+
}

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
"require": "./dist/rollup.cjs",
4848
"import": "./dist/rollup.js"
4949
},
50+
"./rolldown": {
51+
"require": "./dist/rolldown.cjs",
52+
"import": "./dist/rolldown.js"
53+
},
5054
"./esbuild": {
5155
"require": "./dist/esbuild.cjs",
5256
"import": "./dist/esbuild.js"
@@ -80,7 +84,7 @@
8084
"dependencies": {
8185
"@vue/reactivity": "^3.4.33",
8286
"debug": "^4.3.5",
83-
"unplugin": "~1.11.0",
87+
"unplugin": "~1.12.0",
8488
"vite": "^5.3.4"
8589
},
8690
"devDependencies": {

0 commit comments

Comments
 (0)
0