'Cannot read property 'string' of undefined in rollup result

I'm using Joi package to validate and replace parts of the input. Everything works ok but after the rollup I keep getting:

TypeError: Cannot read property 'string' of undefined

which point to:

internals$q.wrap = Joi.string()
.min(1)
.max(2)
.allow(false);

Joi import:

import Joi from 'joi';

dependencies:

"devDependencies": {
        "@rollup/plugin-commonjs": "^21.0.3",
        "@rollup/plugin-json": "^4.1.0",
        "@rollup/plugin-node-resolve": "^13.1.3",
        "rollup-plugin-typescript2": "^0.31.2",
    },
    "dependencies": {
        "joi": "^17.6.0"
    }

rollup.config.json:

import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import config from '../xxx.config.json'
import json from '@rollup/plugin-json'

export default config.Endpoints.map(endpoint => {
    return {
        input: endpoint,
        output: [
         {
          dir: '../publish/',
          format: 'cjs'
         }
        ],
        external: [
        ],
        plugins: [
         typescript({
             tsconfigOverride: {
                 compilerOptions: {
                     module: "es2015",
                     declaration: false
                 }
             }
          }),
          resolve(),
          commonjs(),
          json(),
        ]
       }
    }
 );

Can someone help me with this?

Thanks.

I tried to upgrade rollup and it's plugins.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source