Skip to content

Cannot find module 'lru-cache/min' (something wrong from @vue/compiler-sfc) #9521

Closed
@deot

Description

@deot

Vue version

3.3.7

Link to minimal reproduction

link repro - 1

Steps to reproduce

open repro
CleanShot 2023-11-01 at 01 29 45

What is expected?

no error

What is actually happening?

error

node_modules/.pnpm/@vue+compiler-sfc@3.3.7/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts:1:32 - error TS2307: Cannot find module 'lru-cache/min' or its corresponding type declarations.

1 import * as lru_cache_min from 'lru-cache/min'

Found 1 error in node_modules/.pnpm/@vue+compiler-sfc@3.3.7/node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts:1

Any additional comments?

v3.3.4
CleanShot 2023-11-01 at 01 25 01

v3.3.5
CleanShot 2023-11-01 at 01 26 21

lru-cache@10.0.1
Install lru-cache independently is still failed because there is no lru-cache/min;
CleanShot 2023-11-01 at 09 35 55@2x

I found this problem seems to be more related to tsc. link repro - 2
CleanShot 2023-11-01 at 15 30 30

Suggestion

  1. added lru-cache to dependencies

    "lru-cache": "^10.0.1",

  2. set node instead of bundler on moduleResolution property or only instead for build(tsconfig.build.json), it will work fine.

    "moduleResolution": "bundler",

  3. npm run build-dts
    CleanShot 2023-11-01 at 15 46 07@2x

if it's not a bug, please close the issue. Because moduleResolution property set to bundler will work fine in my project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.regressionscope: types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions