build: make @vue/shared public

This avoids it being inlined multiple times in esm bundler builds
This commit is contained in:
Evan You
2020-02-29 22:04:42 -05:00
parent e1660f4338
commit bcb2a9b4a6
18 changed files with 88 additions and 68 deletions

View File

@@ -185,16 +185,7 @@ This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) set
A [live version](https://vue-next-template-explorer.netlify.com) of the template explorer is also available, which can be used for providing reproductions for compiler bugs. You can also pick the deployment for a specific commit from the [deploy logs](https://app.netlify.com/sites/vue-next-template-explorer/deploys).
- `shared`: **Private.** Utilities shared across multiple packages (especially by both runtime and compiler packages). This package is private and not published. Instead, it is **inlined** into the package that imports it during build.
- **Note:** if re-exporting a function from `@vue/shared` as a public API, it is necessary to re-define its type before exporting so that the final `d.ts` doesn't attempt to import `@vue/shared`, e.g.:
```ts
import { foo } from '@vue/shared'
export const publicFoo = foo as {
/* re-define type */
}
```
- `shared`: Internal utilities shared across multiple packages (especially environment-agnostic utils used by both runtime and compiler packages).
- `vue`: The public facing "full build" which includes both the runtime AND the compiler.