docs(lib): show example entry file (#7233)

This commit is contained in:
Bjorn Lu 2022-03-09 14:32:10 +08:00 committed by GitHub
parent 6c08c863b5
commit cb10ebfc25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,6 +145,15 @@ module.exports = defineConfig({
})
```
The entry file would contain exports that can be imported by users of your package:
```js
// lib/main.js
import Foo from './Foo.vue'
import Bar from './Bar.vue'
export { Foo, Bar }
```
Running `vite build` with this config uses a Rollup preset that is oriented towards shipping libraries and produces two bundle formats: `es` and `umd` (configurable via `build.lib`):
```