Skip to content

Cannot find package '@microsoft/api-extractor' #435

Description

@matthiashermsen

Describe the bug

I installed the unplugin beta version and tried to build in library mode. I'm getting the following error

failed to load config from /home/projects/vitejs-vite-ekzsn1oh/vite.config.ts
error during build:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@microsoft/api-extractor' imported from /home/projects/vitejs-vite-ekzsn1oh/node_modules/unplugin-dts/dist/vite.mjs
    at packageResolve (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:161:9233)
    at moduleResolve (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:161:9926)
    at defaultResolve (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:161:12052)
    at ModuleLoader.defaultResolve (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:157:5815)
    at #n (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:157:5397)
    at ModuleLoader.resolve (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:157:5293)
    at ModuleLoader.getModuleJobForImport (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:157:1852)
    at ModuleJob._link (https://vitejsviteekzsn1oh-kzr3.w-credentialless-staticblitz.com/builtins.97a3df4f.js:158:1632)

How to fix this

As described in the README one must install

npm i -D @microsoft/api-extractor

to fix the error.

Reproduction

https://stackblitz.com/edit/vitejs-vite-xfhr2skw?file=vite.config.ts&view=editor

Steps to reproduce

  • Setup a new Vite library using library mode
  • Install the package via npm i -D unplugin-dts@beta ( found in 1.0.0-beta.0 )
  • Try to build the application and see the error

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    unplugin-dts: 1.0.0-beta.0 => 1.0.0-beta.0 
    vite: 7.0.4 => 7.0.4

Validations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions