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

Support using esm shareable configurations #3040

Closed
bryanjtc opened this issue Nov 1, 2023 · 3 comments
Closed

Support using esm shareable configurations #3040

bryanjtc opened this issue Nov 1, 2023 · 3 comments

Comments

@bryanjtc
Copy link

bryanjtc commented Nov 1, 2023

Current behavior

When I try to use index.mjs or index.js in the extends key of the semantic release config with a package.json using type: module, this error shows up:

[10:36:36 PM] [semantic-release] » ✘  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Projects\semantic-release-monorepo\index.js from C:\Projects\semantic-release-monorepo\node_modules\semantic-release\lib\get-config.js not supported.
Instead change the require of index.js in C:\Projects\semantic-release-monorepo\node_modules\semantic-release\lib\get-config.js to a dynamic import() which is available in all CommonJS modules.
    at file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/lib/get-config.js:38:32
    at async default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/lib/get-config.js:36:11)
    at async Module.default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/index.js:271:34)
    at async default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/cli.js:55:5) {
  code: 'ERR_REQUIRE_ESM'
}

Expected behavior

No error

semantic-release version

22.0.6

CI environment

Github

Plugins used

No response

semantic-release configuration

{
"extends": ["./index.js"]
}

CI logs

 yarn semantic-release --debug --dry-run
[10:36:36 PM] [semantic-release] » ℹ  Running semantic-release version 22.0.6
  semantic-release:config load config from: C:\Projects\semantic-release-monorepo\.releaserc.json +0ms
[10:36:36 PM] [semantic-release] » ✘  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Projects\semantic-release-monorepo\index.js from C:\Projects\semantic-release-monorepo\node_modules\semantic-release\lib\get-config.js not supported.
Instead change the require of index.js in C:\Projects\semantic-release-monorepo\node_modules\semantic-release\lib\get-config.js to a dynamic import() which is available in all CommonJS modules.
    at file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/lib/get-config.js:38:32
    at async default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/lib/get-config.js:36:11)
    at async Module.default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/index.js:271:34)
    at async default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/cli.js:55:5) {
  code: 'ERR_REQUIRE_ESM'
}
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Projects\semantic-release-monorepo\index.js from C:\Projects\semantic-release-monorepo\node_modules\semantic-release\lib\get-config.js not supported.
Instead change the require of index.js in C:\Projects\semantic-release-monorepo\node_modules\semantic-release\lib\get-config.js to a dynamic import() which is available in all CommonJS modules.
    at file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/lib/get-config.js:38:32
    at async default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/lib/get-config.js:36:11)
    at async Module.default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/index.js:271:34)
    at async default (file:///C:/Projects/semantic-release-monorepo/node_modules/semantic-release/cli.js:55:5) {
  code: 'ERR_REQUIRE_ESM'
}
@bryanjtc
Copy link
Author

bryanjtc commented Nov 1, 2023

Related #3036
Fixed by #3037

@travi
Copy link
Member

travi commented Nov 1, 2023

lets keep this contained within the existing issue. duplicate of #3036

@travi travi closed this as completed Nov 1, 2023
@travi travi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2023
@travi
Copy link
Member

travi commented Nov 1, 2023

also, note #3036 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants