Skip to content

Commit 4f0fc00

Browse files
committed
feat: basic functionality
1 parent 879ee48 commit 4f0fc00

21 files changed

+1160
-143
lines changed

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "rsbuild-plugin-example",
3-
"version": "0.0.0",
2+
"name": "rsbuild-plugin-unplugin-vue",
3+
"version": "0.0.1",
44
"repository": "https://github.com/rspack-contrib/rsbuild-plugin-template",
55
"license": "MIT",
66
"type": "module",
@@ -30,15 +30,15 @@
3030
"devDependencies": {
3131
"@biomejs/biome": "^1.9.4",
3232
"@playwright/test": "^1.52.0",
33-
"@rsbuild/core": "^1.3.14",
34-
"@rslib/core": "^0.6.8",
33+
"@rsbuild/core": "^1.3.19",
34+
"@rslib/core": "^0.6.9",
3535
"@types/node": "^22.15.3",
3636
"playwright": "^1.52.0",
3737
"simple-git-hooks": "^2.13.0",
3838
"typescript": "^5.8.3"
3939
},
4040
"peerDependencies": {
41-
"@rsbuild/core": "1.x"
41+
"@rsbuild/core": ">= 1.3.19"
4242
},
4343
"peerDependenciesMeta": {
4444
"@rsbuild/core": {
@@ -49,5 +49,8 @@
4949
"publishConfig": {
5050
"access": "public",
5151
"registry": "https://registry.npmjs.org/"
52+
},
53+
"dependencies": {
54+
"unplugin-vue": "^6.2.0"
5255
}
5356
}

playground/package.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

playground/rsbuild.config.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar"]
3+
}

playground/rsbuild/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "playground-rsbuild",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"build": "rsbuild build",
8+
"dev": "rsbuild dev --open",
9+
"preview": "rsbuild preview"
10+
},
11+
"dependencies": {
12+
"vue": "^3.5.13"
13+
},
14+
"devDependencies": {
15+
"rsbuild-plugin-unplugin-vue": "workspace:*",
16+
"@rsbuild/core": "^1.3.15",
17+
"typescript": "^5.8.3"
18+
}
19+
}

playground/rsbuild/rsbuild.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from '@rsbuild/core';
2+
import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
3+
4+
export default defineConfig({
5+
plugins: [pluginUnpluginVue()],
6+
});

playground/src/index.css renamed to playground/rsbuild/src/App.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
body {
2-
margin: 0;
3-
color: #fff;
4-
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
5-
background-image: linear-gradient(to bottom, #020917, #101725);
6-
}
1+
<template>
2+
<div class="content">
3+
<h1>Rsbuild with Vue</h1>
4+
<p>Start building amazing things with Rsbuild.</p>
5+
</div>
6+
</template>
77

8+
<style scoped>
89
.content {
910
display: flex;
1011
min-height: 100vh;
@@ -24,3 +25,4 @@ body {
2425
font-weight: 400;
2526
opacity: 0.5;
2627
}
28+
</style>

playground/rsbuild/src/env.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference types="@rsbuild/core/types" />
2+
3+
declare module '*.vue' {
4+
import type { DefineComponent } from 'vue';
5+
6+
// biome-ignore lint/complexity/noBannedTypes: reason
7+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
8+
const component: DefineComponent<{}, {}, any>;
9+
export default component;
10+
}

playground/rsbuild/src/index.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
body {
2+
margin: 0;
3+
color: #fff;
4+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
5+
background-image: linear-gradient(to bottom, #020917, #101725);
6+
}

playground/rsbuild/src/index.ts

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

playground/rsbuild/tsconfig.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["DOM", "ES2020"],
4+
"jsx": "preserve",
5+
"target": "ES2020",
6+
"noEmit": true,
7+
"skipLibCheck": true,
8+
"jsxImportSource": "vue",
9+
"useDefineForClassFields": true,
10+
11+
/* modules */
12+
"module": "ESNext",
13+
"isolatedModules": true,
14+
"resolveJsonModule": true,
15+
"moduleResolution": "bundler",
16+
"allowImportingTsExtensions": true,
17+
18+
/* type checking */
19+
"strict": true,
20+
"noUnusedLocals": true,
21+
"noUnusedParameters": true
22+
},
23+
"include": ["src"]
24+
}

playground/rslib/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "playground-rslib",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "rslib build",
7+
"dev": "rslib build --watch"
8+
},
9+
"devDependencies": {
10+
"rsbuild-plugin-unplugin-vue": "workspace:*",
11+
"vue": "^3.5.13"
12+
},
13+
"peerDependencies": {
14+
"vue": "^3"
15+
}
16+
}

playground/rslib/rslib.config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { defineConfig } from '@rslib/core';
2+
import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
3+
4+
export default defineConfig({
5+
lib: [
6+
{
7+
// bundle
8+
format: 'esm',
9+
plugins: [pluginUnpluginVue()],
10+
output: {
11+
cleanDistPath: true,
12+
distPath: {
13+
root: 'dist/bundle',
14+
},
15+
target: 'web',
16+
},
17+
},
18+
{
19+
// bundleless
20+
bundle: false,
21+
format: 'esm',
22+
plugins: [pluginUnpluginVue()],
23+
output: {
24+
cleanDistPath: true,
25+
distPath: {
26+
root: 'dist/bundleless',
27+
},
28+
target: 'web',
29+
},
30+
},
31+
],
32+
});

playground/rslib/src/Button.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script setup>
2+
import './style.css';
3+
import { ref } from 'vue';
4+
const button = ref('Hello World!');
5+
</script>
6+
7+
<template>
8+
<p class="button">{{ button }}</p>
9+
</template>
10+
11+
<style>
12+
.button {
13+
color: blue;
14+
}
15+
</style>

playground/rslib/src/Card.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script setup>
2+
import { ref } from 'vue';
3+
const card = ref('Hello World!');
4+
</script>
5+
6+
<template>
7+
<p class="card">{{ card }}</p>
8+
</template>
9+
10+
<style>
11+
.card {
12+
color: red;
13+
font-weight: bold;
14+
}
15+
</style>

playground/rslib/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as Button } from './Button.vue';
2+
export { default as Card } from './Card';

playground/rslib/src/style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.base {
2+
border-radius: 0.5rem;
3+
}

playground/src/index.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)