Skip to content

Error while importing: SyntaxError: Named export 'ContainerTypes' not found. The requested module 'express-joi-validation' is a CommonJS module #44

@mukhammad-akilov

Description

@mukhammad-akilov

I am facing SyntaxErro while trying to import from express-joi-validation:

`
import { ContainerTypes, createValidator, } from 'express-joi-validation';
^^^^^^^^^^^^^^
SyntaxError: Named export 'ContainerTypes' not found. The requested module 'express-joi-validation' is a CommonJS
module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'express-joi-validation';
const { ContainerTypes, createValidator, } = pkg;
`

I have the following tsconfig.json:
{ ..... "target": "ES2020", "lib": [ "ES6", ], "module": "NodeNext", ..... }

Any package.json looks like this:
.... "type": "module" ......

The whole project is located in this repository:
https://github.com/mukhammad-akilov/epam-nodejs-mentoring

Could you please go to hometask-3 branch and run npm run home-task-2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions