Why would Vite not build Typescript definitions on rebuild?

60 Views Asked by At

My package.json has "build": "vite build". Whenever I run yarn build, the TS definitions show up where I expect. When I run it again, the TS definitions disappear. I can re-run the build step and it literally alternates every other time.

import { resolve } from 'path';
import { defineConfig } from 'vite';
import typescript from '@rollup/plugin-typescript';

export default defineConfig({
  build: {
    target: 'es2015',
    lib: {
      // Could also be a dictionary or array of multiple entry points
      entry: resolve(__dirname, 'src/index.ts'),
      formats: ['cjs', 'es'],
      // the proper extensions will be added
      fileName: 'index',
    },
    rollupOptions: {
      // make sure to externalize deps that shouldn't be bundled
      // into your library
      external: ['lodash-es'],
      plugins: [typescript()],
    },
  },
});

It looks like the TS plugin just isn't being run every other time?

definition files shown definition files missing

0

There are 0 best solutions below