Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[!] (plugin svelte-dts) TypeError: Cannot read properties of undefined (reading 'output') #7

Open
colantuomo opened this issue Jan 3, 2023 · 1 comment

Comments

@colantuomo
Copy link

Hi guys!
I've added this library to a project but Im receiving this error, I dont know what I did wrong.

[!] (plugin svelte-dts) TypeError: Cannot read properties of undefined (reading 'output')

My rollup config looks like this:

import svelte from 'rollup-plugin-svelte';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import autoPreprocess from 'svelte-preprocess';
import svelteDts from 'svelte-dts';

import pkg from './package.json';

const name = pkg.name
  .replace(/^(@\S+\/)?(svelte-)?(\S+)/, '$3')
  .replace(/^\w/, (m) => m.toUpperCase())
  .replace(/-\w/g, (m) => m[1].toUpperCase());

export default {
  input: 'src/index.svelte',
  output: [
    { file: pkg.module, format: 'es' },
    { file: pkg.main, format: 'umd', name },
  ],
  plugins: [
    svelteDts(),
    resolve(),
    commonjs(),
    svelte({ preprocess: autoPreprocess() }),
    typescript(),
  ],
};
@fox-foxivich
Copy link

if it's gonna help you somehow you gotta pass an options object and define name property which would be your d.ts file. But beat it, it's not working anyway. This plugin and documentation just sucks

But you can try to do something like that

svelteDts({ name: "dist/types.d.ts" })

or just define it in "types" prop in your package.json, cuz it uses it by default. Idk, i've been trying to make it work for like 2 hours and no success. Just find another package which works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants