andrelmlins / svelte-dts

Typescript declaration generator for svelte with typescript
MIT License
28 stars 3 forks source link

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined #5

Open FluffyDiscord opened 2 years ago

FluffyDiscord commented 2 years ago

Hi, would you consider adding Vite support ?

19:52:32 [vite] vite.config.js changed, restarting server...
error when starting dev server:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:372:5)
    at validateString (node:internal/validators:120:11)
    at Object.isAbsolute (node:path:403:5)
    at new Generator (C:\wamp64\www\msd2\node_modules\svelte-dts\dist\generator.js:50:37)
    at Context.<anonymous> (C:\wamp64\www\msd2\node_modules\svelte-dts\dist\svelteDts.js:23:29)
    at Generator.next (<anonymous>)
    at C:\wamp64\www\msd2\node_modules\svelte-dts\dist\svelteDts.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\wamp64\www\msd2\node_modules\svelte-dts\dist\svelteDts.js:4:12)
    at Context.buildStart (C:\wamp64\www\msd2\node_modules\svelte-dts\dist\svelteDts.js:22:20)
error Command failed with exit code 1.

package.json

{
"devDependencies": {
    "@types/bootstrap": "^5.1.12",
    "@types/nprogress": "^0.2.0",
    "tailwindcss": "^3.1.6",
    "vite": "^3",
    "vite-define-envs-plugin": "^0.1.1",
    "vite-plugin-symfony": "^0.3.1"
  },
  "dependencies": {
    "@inertiajs/inertia": "^0.11.0",
    "@inertiajs/inertia-svelte": "^0.8.0",
    "@inertiajs/progress": "^0.2.7",
    "@sveltejs/vite-plugin-svelte": "^1.0.1",
    "autoprefixer": "^10.4.7",
    "axios": "^0.27.2",
    "gsap": "^3.10.4",
    "nouislider": "^15.6.0",
    "nprogress": "^0.2.0",
    "path": "^0.12.7",
    "postcss": "^8.4.14",
    "postcss-scss": "^4.0.4",
    "sass": "^1.54.0",
    "svelte": "^3.49.0",
    "svelte-content-loader": "^1.1.3",
    "svelte-dts": "^0.3.7",
    "svelte-motion": "^0.11.2",
    "svelte-preprocess": "^4.10.7",
    "svelte-previous": "^2.1.1",
    "swr": "^1.3.0",
    "typescript": "^4.7.4"
  },
}

vite.config.js

import { defineConfig } from "vite"
import symfonyPlugin from "vite-plugin-symfony"
import { svelte } from '@sveltejs/vite-plugin-svelte'
import sveltePreprocess from 'svelte-preprocess'
import svelteDts from 'svelte-dts'
import dns from 'dns'

dns.setDefaultResultOrder('verbatim')

export default defineConfig({
    plugins: [
        symfonyPlugin(),
        svelteDts(),
        svelte({
            preprocess: [sveltePreprocess({ typescript: true })],
            experimental: {
                prebundleSvelteLibraries: true,
            },
            hot: {
                // preserveLocalState: true,
            }
        }),
    ],
    server: {
        host: "127.0.0.1",
        hmr: true
    },
    root: ".",
    base: "/build/",
    build: {
        manifest: true,
        emptyOutDir: true,
        assetsDir: "",
        outDir: "./public/build",
        rollupOptions: {
            input: {
                app: "./assets/App/app.js",
                presentation: "./assets/presentation/presentation.ts",
            },
        },
    },
    resolve: {
        dedupe: ["axios", "svelte-motion", "framer-motion", "gsap", "nouislider"],
    },
});
andrelmlins commented 2 years ago

Yes, it would be interesting to have this support, are you interested in bringing this improvement?