Задать вопрос
@GaserV

Почему Vite локально билдится а на сервере нет?

Добрый вечер. Столкнулся с проблемой. Локально все билдится. А вот на серваке нет. Пишет Could not resolve entry module "index.html". Файлик лежит в корне. Из-за чего может быть? Куда копать?
import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';
import viteTsconfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
  // depending on your application, base can also be "/"
  base: '',
  root: path.resolve(__dirname, './'),
  plugins: [react(), viteTsconfigPaths(), svgr()],
  server: {
    open: true,
    port: 3000,
  },
  optimizeDeps: {
    include: ['**/*.css', '**/*.scss'], // Include all .scss files
  },
  build: {
    outDir: './build',
    rollupOptions: {
      input: {
        main: path.resolve(__dirname, './index.html'), // Explicitly set the input
      },
      // make sure to externalize deps that shouldn't be bundled
      // into your library
      external: ['react', 'react-dom'],
      output: {
        // Provide global variables to use in the UMD build
        // for externalized deps
        globals: {
          react: 'React',
          'react-dom': 'ReactDOM',
        },
      },
    },
    emptyOutDir: true,
    sourcemap: true, // Generate source maps for debugging
    minify: true, // Minify the output
    cssCodeSplit: false,
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'), // Add alias for easy access
    },
  },
});
  • Вопрос задан
  • 14 просмотров
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы