Open
Description
The base repo has converted to ESM. This is causing me some headaches:
- My config file is TS that's compiled to JS. The only TypeScript types that exist are for
@types/semantic-release
which exports as ESM. - SRP is still CommonJS and thus fails with the following error:
An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module /__w/libraries/libraries/packages/eslint-config/.releaserc.mjs not supported.
root: Instead change the require of /__w/libraries/libraries/packages/eslint-config/.releaserc.mjs to a dynamic import() which is available in all CommonJS modules.
root: at /__w/libraries/libraries/node_modules/semantic-release-plus/lib/get-config.js:30:32
root: at Array.reduce (<anonymous>)
root: at module.exports (/__w/libraries/libraries/node_modules/semantic-release-plus/lib/get-config.js:29:33)
root: at async module.exports (/__w/libraries/libraries/node_modules/semantic-release-plus/index.js:357:34)
root: at async module.exports (/__w/libraries/libraries/node_modules/semantic-release-plus/cli.js:102:5) {
root: code: 'ERR_REQUIRE_ESM'
root: }
root: Error [ERR_REQUIRE_ESM]: require() of ES Module /__w/libraries/libraries/packages/eslint-config/.releaserc.mjs not supported.
root: Instead change the require of /__w/libraries/libraries/packages/eslint-config/.releaserc.mjs to a dynamic import() which is available in all CommonJS modules.
root: at /__w/libraries/libraries/node_modules/semantic-release-plus/lib/get-config.js:30:32
root: at Array.reduce (<anonymous>)
root: at module.exports (/__w/libraries/libraries/node_modules/semantic-release-plus/lib/get-config.js:29:33)
root: at async module.exports (/__w/libraries/libraries/node_modules/semantic-release-plus/index.js:357:34)
root: at async module.exports (/__w/libraries/libraries/node_modules/semantic-release-plus/cli.js:102:5) {
root: code: 'ERR_REQUIRE_ESM'
root: }
There are some possible workarounds:
- Convert to CommonJS and use TypeScript import assertions - an ugly workaround, and currently requires the TS nightly build.
- Convert to CommonJS and tell TS to forget about it via
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
and// @ts-ignore next
just before the import of the types fromsemantic-release
. This is what I'm going with ATM to get pas this issue. - Write the config file in raw JS. Eww. No. Been there, fought the bugs.
I'm using JS config files to help support a home-brewed merging "extends" functionality from a central config that really helped with centralizing my release config without compromising the per-package needs.
Metadata
Metadata
Assignees
Labels
No labels