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

pluginutils (via TypeScript plugin): Cannot find module 'estree' #1315

Closed
meyfa opened this issue Oct 12, 2022 · 7 comments
Closed

pluginutils (via TypeScript plugin): Cannot find module 'estree' #1315

meyfa opened this issue Oct 12, 2022 · 7 comments

Comments

@meyfa
Copy link
Contributor

meyfa commented Oct 12, 2022

I'm getting an error with the newest version of the TypeScript plugin. This did not happen before the Rollup 3 preparations.

How to reproduce:

  1. npm install --save-dev typescript rollup @rollup/plugin-typescript
  2. Define a config with the typescript plugin.
  3. Perform a TypeScript typecheck, e.g. via tsc --noEmit.

Expected Behavior

The typecheck succeeds.

Actual Behavior

TypeScript outputs the following error:

node_modules/@rollup/pluginutils/types/index.d.ts:2:26 - error TS2307: Cannot find module 'estree' or its corresponding type declarations.

2 import { BaseNode } from 'estree';
                           ~~~~~~~~

Found 1 error in node_modules/@rollup/pluginutils/types/index.d.ts:2

Additional Information

@meyfa
Copy link
Contributor Author

meyfa commented Oct 12, 2022

> npm ls estree
rollup-typescript-estree-repro@0.0.0 C:\Users\meyfa\GitHub\rollup-typescript-estree-repro
`-- (empty)

Seems like estree isn't part of the dependency tree at all. On the other hand, estree-walker is. Maybe that one should be used? It also exports a BaseNode type.

@lukastaegert
Copy link
Member

Maybe that one should be used? It also exports a BaseNode type.

Good idea. I will see if I can prepare a PR that fixes this.

@lukastaegert
Copy link
Member

Apparently, entree-walker is guilty of the same issue... Maybe we just need to put in that dependency. I wonder why this issue did not turn up for the previous version.

@meyfa
Copy link
Contributor Author

meyfa commented Oct 13, 2022

Ah, sorry, I just realized we have to search the NPM tree for @types/estree, not estree itself. This gets us some useful information.

With @rollup/plugin-typescript@8.5.0:

> npm ls @types/estree
rollup-typescript-estree-repro@0.0.0 C:\Users\meyfa\GitHub\rollup-typescript-estree-repro
`-- @rollup/plugin-typescript@8.5.0
  `-- @rollup/pluginutils@3.1.0
    `-- @types/estree@0.0.39

With @rollup/plugin-typescript@9.0.1:

> npm ls @types/estree
rollup-typescript-estree-repro@0.0.0 C:\Users\meyfa\GitHub\rollup-typescript-estree-repro
`-- (empty)

This patch here seems guilty: ce0652d

@meyfa
Copy link
Contributor Author

meyfa commented Oct 13, 2022

I would argue that pluginutils should have @types/estree moved back into dependencies, since it does export something from there, which is clearly needed for downstream consumers of pluginutils.

@lukastaegert
Copy link
Member

Agreed. Looking at the original PR, it looks like this change might have been an accident #616.

@meyfa
Copy link
Contributor Author

meyfa commented Oct 13, 2022

I made a PR: #1320

lukastaegert added a commit that referenced this issue Oct 20, 2022
* fix: Update dependency `@rollup/pluginutils` to ^5.0.1

pluginutils version 4 has a missing production dependency on
`@types/estree`, which manifested itself in issue #1315.
pluginutils v5.0.1 is now released that fixes this problem (via #1320).
This patch updates all plugins that depend on pluginutils to use the
fixed version.

* fix(babel): Revert pluginutils update

* fix(repo): Update remaining Rollup dependencies

Co-authored-by: Lukas Taegert-Atkinson <lukas.taegert-atkinson@tngtech.com>
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