Ignore specific sourcemap error
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
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 :
```ts
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;
}
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.
Contributor guide
Research direction
Start by reproducing the build that imports knex/lib/dialects/mysql2/index.js and inspect how the missing knex/lib/dialects/index.js.map is handled. Confirm whether the specific missing map can be ignored while other .js.map files continue to generate, and verify the result across repeated builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100