ITADN

Shared ESM config in node_modules fails to load (cspell.config.mjs) – “Stripping types unsupported under node_modules”

#5085Closedrycu 创建于 2026-02-09
R
rycucommented
## Summary Using a shared CSpell config published as an npm package and imported from a project `cspell.config.mjs` causes the VS Code extension to fail to read the config and show repeated error notifications. This is currently blocking adoption of the latest extension version across our team. ## Error messages ![Image](https://github.com/user-attachments/assets/dbb89399-bd84-44ef-81c4-bd2af1a53fbb) Error: Failed to read config file: "/Users/.../cspell.config.js" Stripping types is currently unsupported for files under node_modules, for "/Users/.../node_modules/...-developer-experience/src/index.ts" Error: Failed to read config file: "/Users/.../cspell.config.mjs" Cannot find package '...-developer-experience' imported from /Users/.../cspell.config.mjs Source: Code Spell Checker ## Minimal repro 1. Publish a shared config package (ESM) 2. Install it in a project 3. Import it from `cspell.config.mjs` ``` js import config from "my-cspell-config"; export default config; ``` 4. Open project in VS Code / reload window ## Expected behavior Shared configs from npm load successfully, or are ignored without user-facing errors. ## Actual behavior Repeated "Failed to read config file" notifications on startup/reload. Due to the volume of errors, we've had to roll our team back to a previous extension version. ## Environment - OS: macOS - VS Code: 1.108.2 - Extension: Code Spell Checker 4.5.6 - Node: 22.12.0 - Config format: `cspell.config.mjs`
关闭于 2026-02-12 7 条评论