Beispiel
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
Fall
- Ziel
- 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
- Pakete
- @rollup/plugin-commonjs 29.0.3 rollup 4.62.4
- Umgebung
- node
- Erstellt
- 2026-08-16T15:53:03Z
Häufige Annahme
When an ES module imports a CommonJS module that defines exports.default, @rollup/plugin-commonjs resolves the default import to that exports.default value.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- 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.
Dateien
- NOTES.md
- csx.json
- package-lock.json
- package.json
- test/contract.mjs
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9