Skip to content

"not a function" error when importing slugify from TypeScript #196

@anitacheung83

Description

@anitacheung83

Description:

I am encountering the same issue described in #24. Despite trying all the suggested solutions, the slugify import still does not work.

It appears that when importing slugify, I am importing slugify.d.ts (the type declaration file) instead of the actual function itself.

Steps to Reproduce:

  1. Install slugify using npm install slugify.
  2. Import slugify in a TypeScript file:
    import slugify from 'slugify';
  3. Attempt to use slugify in the code:
    const result = slugify('Hello World!');
  4. Observe the error:
    TypeError: __vite_ssr_import_1__.default is not a function
    

Environment:

  • Node.js version: v18.14.0
  • TypeScript version: Version 5.1.6
  • slugify version: slugify@1.6.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions