Unverified50% confidenceSolutionExact time
In the configuration question, the source code is ESM but Node was told to parse it as CommonJS, producing the error "Cannot use import outside a module"; the correct approach is to change the type field in package.json rather than deleting the tests.
1
Sources
50%
Confidence
Long-term
Relevance
10/21/2026
First Seen
Sources
Related Entities
Related Claims
UnverifiedTree Shaking 依赖 ES Modules 而非 CommonJS,因为 ES Modules 的 import/export 是静态声明,编译器无需执行代码即可确定依赖关系,而 CommonJS 的 require() 是运行时调用无法静态分析70% similarUnverifiedLittleJS is pure ES modules with no build step and no npm dependencies from top to bottom, and can be run directly by dropping it into a <script type="module">.64% similarUnverifiedTypeScript 编译器 tsc 会剥离类型标注生成标准 JavaScript,并可通过 tsconfig.json 的 target 字段进行语法降级(如将 ES2022 编译为 ES5)61% similarUnverifiedESLint 是 JavaScript/TypeScript 生态中最主流的静态代码分析工具,能检查代码风格并发现潜在的逻辑错误和安全漏洞60% similarUnverifiedBun 实现了对 Node.js API 和 npm 包的高度兼容,同时支持 CommonJS 与 ES Modules 两种模块系统60% similar
Cite This Claim
Stable URI
https://kongchang.com/claim/1081918API
curl https://kongchang.com/api/v1/knowledge/claims/1081918MCP
get_claim(id=1081918)