Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Act on finding "type":"module" #435

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
### Fixed
- type-referencing a property that is a key no longer breaks the referring property
- leaving `target_module_type` at `'auto'` now properly acts on a detected `"type":"module"`

### Added
- cds aspects now generate a synthetic plural type too, to be used in `composition of many`
Expand Down
6 changes: 4 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ class Config {
this.proxy = camelSnakeHybrid(this.values)
if (this.proxy.targetModuleType === 'auto') {
const type = getProjectTargetType(cds.root)
let detectedType = 'cjs'
if (type) {
LOG.info(`automatically detected module type '${type}' in ${cds.root}`)
this.values.targetModuleType = type
detectedType = type
} else {
LOG.warn(`target module type was set to 'auto', but could not detect module type in ${cds.root}. Falling back to cjs`)
this.values.targetModuleType = 'cjs'
}
this.values.targetModuleType = detectedType
this.proxy.targetModuleType = detectedType
}
}

Expand Down
Loading