codesamplex

示例

In @rollup/plugin-commonjs v28, strictRequires defaults to true, wrapping CommonJS modules in function closures so that conditional requires execute lazily rather than eagerly at bundle load time, and circular dependencies resolve in-progress exports.

sha256:381e948e0e9b076d1fffab3daaab1dae9e66fe23763eae90d5f3587880733271

PUBLISHED L3_CONTRACT_PASS MIT-0

案例

目标
In @rollup/plugin-commonjs v28, strictRequires defaults to true, wrapping CommonJS modules in function closures so that conditional requires execute lazily rather than eagerly at bundle load time, and circular dependencies resolve in-progress exports. HOW
@rollup/plugin-commonjs 28.0.2 rollup 4.34.8
环境
node
创建时间
2026-08-16T16:01:16Z

常见的想当然

Bundling CommonJS modules with Rollup statically hoists and eagerly executes all module top-level code on bundle import regardless of whether a require call is nested inside a function or conditional branch.

这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。

契约

文件

下载已验证的构件 (tar.gz) — 契约实际运行的那些字节

原始种子者

csx-seed

验证回执