Skip to content

Commit

Permalink
fix: add env var to disable link warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Nov 12, 2024
1 parent 6daeb40 commit df48c93
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/config/ts-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Plugin, TSConfig} from '../interfaces'
import {settings} from '../settings'
import {existsSync} from '../util/fs'
import {readTSConfig} from '../util/read-tsconfig'
import {isProd} from '../util/util'
import {isProd, isTruthy} from '../util/util'
import {makeDebug} from './util'

const debug = makeDebug('ts-path')
Expand Down Expand Up @@ -314,7 +314,12 @@ export async function tsPath(
debug(
`Skipping typescript path lookup for ${root} because it's an ESM module (NODE_ENV: ${process.env.NODE_ENV}, root plugin module type: ${rootPlugin?.moduleType})`,
)
if (plugin?.type === 'link')

const warningIsDisabled =
process.env.OCLIF_DISABLE_LINKED_ESM_WARNING && isTruthy(process.env.OCLIF_DISABLE_LINKED_ESM_WARNING)

// Only warn if the plugin is linked AND the warning is not disabled
if (plugin?.type === 'link' && !warningIsDisabled)
memoizedWarn(
`${plugin?.name} is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.`,
)
Expand Down

0 comments on commit df48c93

Please sign in to comment.