egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
9.31k stars 224 forks source link

Question: Any way to not bundle in-source testing (coming from vitest) #625

Open itstheandre opened 2 years ago

itstheandre commented 2 years ago

First of all, thank you for such a great package!

Second, do you know if it's possible to not build a section like vitest has in its docs?

something like ignoring everything in an if block by environmental variable?

Upvote & Fund

Fund with Polar

KarmaBlackshaw commented 2 years ago

Waiting for this 🙂

egoist commented 2 years ago

Adding this in your tsup config should work:

export default defineConfig({
  // use rollup for treeshaking
  treeshake: true,
  define: {
    'import.meta.vitest': false
  }
})
mogeko commented 1 year ago

Adding this in your tsup config should work:

export default defineConfig({
  // use rollup for treeshaking
  treeshake: true,
  define: {
    'import.meta.vitest': false
  }
})

The code here should be:

export default defineConfig({
  // use rollup for treeshaking
  treeshake: true,
  define: {
    'import.meta.vitest': 'false'
  }
})
roycrippen4 commented 1 month ago

The code provided by @mogeko worked for me.

export default defineConfig({
  // use rollup for treeshaking
  treeshake: true,
  define: {
    'import.meta.vitest': 'false'
  }
})