Skip to content

3.3.0 causing ts compilation to fail #54

Closed
@steve-baldwin

Description

@steve-baldwin

We tried to upgrade from 3.2.0 to 3.3.0 and now have typescript compilation issues. For example:

[~/git/unsullied] yarn ts-node
yarn run v1.22.19
$ /Users/stbaldwin/git/unsullied/node_modules/.bin/ts-node
> const toJsonSchema = require('@openapi-contrib/openapi-schema-to-json-schema');
/Users/stbaldwin/git/unsullied/node_modules/@openapi-contrib/openapi-schema-to-json-schema/dist/cjs/lib/converters/schema.js:851
undefined
                   ^

Uncaught:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/stbaldwin/git/unsullied/node_modules/lodash-es/lodash.js from /Users/stbaldwin/git/unsullied/node_modules/@openapi-contrib/openapi-schema-to-json-schema/dist/cjs/lib/converters/schema.js not supported.
Instead change the require of lodash.js in /Users/stbaldwin/git/unsullied/node_modules/@openapi-contrib/openapi-schema-to-json-schema/dist/cjs/lib/converters/schema.js to a dynamic import() which is available in all CommonJS modules.
:

Our tsconfig.json:

{
    "compilerOptions": {
        "allowJs": false,
        "module": "commonjs",
        "declaration": true,
        "removeComments": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "strict": true,
        "suppressImplicitAnyIndexErrors": true,
        "ignoreDeprecations": "5.0",
        "target": "es2020",
        "lib": ["es2020"],
        "sourceMap": true,
        "outDir": "./dist",
        "baseUrl": "./",
        "paths": {
            "@/*": ["src/*"],
            "*": ["src/typings/*"]
        }
    },
    "exclude": ["node_modules", "aurora", "build", "dist", "dev-tools"]
}

Thanks,

Steve

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions