-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(examples): add vue-component-bundle example (#459)
- Loading branch information
1 parent
db602d2
commit 39ba4d9
Showing
8 changed files
with
435 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @examples/vue-component | ||
|
||
This example demonstrates how to use Rslib to build a simple Vue component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "@examples/vue-component-bundle", | ||
"private": true, | ||
"type": "module", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "rslib build && vue-tsc" | ||
}, | ||
"devDependencies": { | ||
"@rsbuild/plugin-vue": "^1.0.5", | ||
"@rslib/core": "workspace:*", | ||
"typescript": "^5.6.3", | ||
"vue": "^3.5.13", | ||
"vue-tsc": "^2.1.10" | ||
}, | ||
"peerDependencies": { | ||
"vue": ">=3.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { pluginVue } from '@rsbuild/plugin-vue'; | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
plugins: [pluginVue()], | ||
lib: [ | ||
{ | ||
format: 'esm', | ||
output: { | ||
distPath: { | ||
css: '.', | ||
}, | ||
}, | ||
}, | ||
], | ||
output: { | ||
target: 'web', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<div> | ||
<h2 class="counter-text">Counter: {{ count }}</h2> | ||
<counter-button @click="decrement" label="-" /> | ||
<counter-button @click="increment" label="+" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import CounterButton from './CounterButton.vue'; | ||
const count = ref(0); | ||
const increment = () => count.value++; | ||
const decrement = () => count.value--; | ||
</script> | ||
|
||
<style scoped> | ||
.counter-text { | ||
font-size: 50px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<button type="button" @click="onClick">{{ label }}</button> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps<{ | ||
label: string; | ||
onClick: () => void; | ||
}>(); | ||
</script> | ||
|
||
<style scoped> | ||
.button { | ||
background: yellow; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Counter from './Counter.vue'; | ||
|
||
export { Counter }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"baseUrl": ".", | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"outDir": "dist", | ||
"lib": ["DOM", "ESNext"], | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"rootDir": "src", | ||
"skipLibCheck": true, | ||
"strict": true | ||
}, | ||
"exclude": ["**/node_modules"], | ||
"include": ["src"] | ||
} |
Oops, something went wrong.