这是indexloc提供的服务,不要输入任何密码
Skip to content

Ignore specific sourcemap error #1350

@throrin19

Description

@throrin19

Hi,

I have a trouble with tsup and it is really random. In my project I use knex with mysql2 dialect and I load it like that in my project :

import type { Knex } from 'knex';
import { getConfiguration } from '@aquassay/configuration';
import knex from 'knex';
import KnexMysql2 from 'knex/lib/dialects/mysql2/index.js';

export interface RdsMiddlewareConfig {
    pool?: Pick<Knex.PoolConfig, 'max'>;
}

export const connect = (params?: RdsMiddlewareConfig) => {
    const config = getConfiguration();

    return knex({
        client: KnexMysql2,
        connection: {
            database: config.rds.database,
            decimalNumbers: true,
            host: config.rds.host,
            multipleStatements: true,
            password: config.rds.password,
            port: config.rds.port,
            timezone: '+00:00',
            /* istanbul ignore next -- @preserve */
            typeCast(field: { length: number; string: () => string; type: string }, next: () => void) {
                // used to convert TINYINT to boolean
                if (field.type === 'TINY' && field.length <= 4) {
                    return field.string() === '1';
                }
                return next();
            },
            user: config.rds.user,
        },
        pool: {
            max: params?.pool?.max || 1,
            min: 0,
        },
    });
};

export const disconnect = async (db: Knex) => {
    await db.destroy();
};

The problem is the dialect. I have to do that to avoid import all knex dialects in compiled source code but I have this error in Tsup :

ERROR  failed to read input source map: failed to find input source map file "index.js.map" in "/my-project/node_modules/knex/lib/dialects/index.js" file as either "/my-project/node_modules/knex/lib/dialects/index.js.map" or with appended .map

But in my CI, sometimes it compile fine, sometimes the error stop the compilation.

How to ignore this specific .js/map error ? I don't want to stop all .js.map generation.

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