Skip to content

No longer valid CommonJS import #796

Closed
@BrannenGH

Description

@BrannenGH

Hello,

With the recent update to 13.0.9, all my usages of swagger-typescript-api using CommonJS modules has broken.

For example, consider the following import:

const { generateApi } = require('swagger-typescript-api');

With the new version, this fails with:

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/brann/Source/repos/swagger-common/node_modules/swagger-typescript-api/src/index.js from /Users/brann/Source/repos/swagger-common/index.js not supported.
Instead change the require of /Users/brann/Source/repos/swagger-common/node_modules/swagger-typescript-api/src/index.js in /Users/brann/Source/repos/swagger-common/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/brann/Source/repos/swagger-common/index.js:1:25) {
  code: 'ERR_REQUIRE_ESM'
}

Would it be possible to ship a version transpiled to CommonJS to NPM as well for backwards compatibility?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions