vue
vue copied to clipboard
build: add type declarations to `/dist`
Before you submit:
- [x] Please read the contributing guidelines
- [x] Please search through the existing issues (both open AND closed) to see if your feature has already been discussed. Github issue search can be used for this: https://github.com/imgix/vue/issues?utf8=%E2%9C%93&q=is%3Aissue
- [x] Please take a moment to find out whether your idea fits with the scope and aims of the project
Is your feature request related to a problem? Please describe.
Type declaration .d.ts
file should be included for each bundle in /dist
Describe the solution you'd like
Use a build step to place emitted declaration files into /dist
Describe alternatives you've considered
Using the package.json
types: "src/plugins/imgix-vue"
field. This is sub-optimal because the types are not bundled together.
Additional context
- RFC https://github.com/imgix/vue/pull/516 showcasing using the
package.json
field
We could make use of vite-plugin-dts
and add { rollupTypes: true }
.
// [vite.config.js](https://github.com/imgix/vue/blob/9aebc6f129422ed21a9272f1a7e3fd9b3207794e/vite.config.js#L41)
import dts from 'vite-plugin-dts';
// ...
export default defineConfig({
// ...
plugins: [vue(), dts({ rollupTypes: true })],
// generates imgix-vue.esm.d, imgix-vue.min.d
})
Assigned to @namack.
Don't hesitate to reach out if you need any help/feedback tackling this!