title: How can I exclude a vue folder from being build in vite?
body: <p>Is it possible to exclude a complete (lazy loaded) folder from a vite build?
  If so how.</p>
  <pre><code>import { defineConfig } from 'vite'
  import { resolve as resolver } from 'path'
  
  import vue from '@vitejs/plugin-vue'
  import ViteComponents from 'vite-plugin-components'
  
  const resolve = {
      alias: {
          'vue': 'vue/dist/vue.esm-bundler.js',
          '@': resolver(__dirname, './src')
      }
  }
  
  const plugins = [
      vue(),
      ViteComponents({
          dirs: ['src/shared/components'],
          extensions: ['vue'],
          deep: true,
      })
  ]
  
  const build = {
          outDir: 'dist',
          assetsDir: 'assets',
          assetsInlineLimit: '4096',
  
          cssCodeSplit: false, // single CSS
  
          sourcemap: false,
          manifest: false,
          chunkSizeWarningLimit: 1000,
      }
  
  // https://vitejs.dev/config/
  
  export default defineConfig(({ command, mode }) =&gt; {
      if (command === 'serve') {
          return {
              // serve specific config
              plugins,
              resolve,
          }
      } else {
          return {
              // build specific config
              plugins,
              resolve,
              build
          }
      }
  
  })
  </code></pre>
  <p><code>npm run build</code></p>
  <p>is building my Examples. But I don't need them in production.</p>
  <pre><code>...
  dist/assets/ExampleListGroup.58bffc95.js        0.70 KiB / gzip: 0.43 KiB
  dist/assets/ExampleMainTitle.4841825d.js        0.66 KiB / gzip: 0.39 KiB
  dist/assets/ExampleMarkdownEditor.05ed02a3.js   0.67 KiB / gzip: 0.39 KiB
  dist/assets/ExampleMenuStructure.36b10505.js    0.68 KiB / gzip: 0.41 KiB
  dist/assets/ExampleMarkDown.ef4418d4.js         0.68 KiB / gzip: 0.40 KiB
  dist/assets/ExamplePopupMenu.9c9d49e2.js        0.60 KiB / gzip: 0.38 KiB
  dist/assets/ExampleObjectSelect.bc2a5189.js     4.86 KiB / gzip: 1.36 KiB
  ...
  </code></pre>
  <p>I'd like to exclude them before build, not remove them after the build.</p>
  <p>Thanks.</p>