Пример
Importing the default export of a CommonJS module with exports.default returns the entire module.exports object unless exports.__esModule is set or defaultIsModuleExports is configured.
sha256:38845162824e7e10f81dba9d9e478a2c987a2a1f19c3dcc6851d4a01241065dd
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Кейс
- Цель
- Importing the default export of a CommonJS module with exports.default returns the entire module.exports object unless exports.__esModule is set or defaultIsModuleExports is configured. HOW
- Пакеты
- @rollup/plugin-commonjs 29.0.3 rollup 4.62.4
- Окружение
- node
- Создан
- 2026-08-16T15:53:03Z
Что обычно предполагают
When an ES module imports a CommonJS module that defines exports.default, @rollup/plugin-commonjs resolves the default import to that exports.default value.
Автор образца записал здесь то, чего ожидал бы разработчик или модель. Контракт ниже — это то, что действительно выполнялось.
Контракт
- Importing a CommonJS module defining exports.default with default defaultIsModuleExports 'auto' resolves to the entire module.exports object rather than exports.default because __esModule is not set.
- CommonJS modules with exports.__esModule true resolve default imports directly to exports.default under defaultIsModuleExports 'auto'.
- Setting defaultIsModuleExports false forces default imports to resolve directly to exports.default even without __esModule.
- Setting defaultIsModuleExports true forces default imports to resolve to module.exports even when exports.__esModule is true.
Файлы
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9