Open tmg0 opened 1 month ago
Thanks! I’m glad you like it! It should be simple to add but what folder to you want to write to that doesn’t exist? if implemented, I would prefer to reuse any existing dep
Thank you for your reply!
I'm trying to add all dts files to a single folder like .types
, and here is my config file:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueRouter from 'unplugin-vue-router/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vueRouter({ dts: '.types/typed-router.d.ts' }),
vue()
],
})
But when I run the build script, it seems there are some errors: ENOENT: no such file or directory
. It seems necessary to manually create the parent directory.
So I'm considering if it's possible to implement ensuring the folder exists in this plugin.
Maybe use native node fs module is a better way? like: await fs.mkdir(dirname(dts), { recursive: true })
Using the native module sounds good
This is a really awesome package, I have been using it in my vite project with default options, it works great. But there are some options that confuse me.
options.dts
support to use a string as a path of target dts file path, I would love to adding support for auto generate dir if does not exist. And maybe we can usefs-extra
ensure the path incontext
? or impl aensureDir
function manully(I have created a demo for this
If needed, I would be happy to provide a PR for this issue.
Thank you for your consideration.