nonzzz / vite-plugin-stylex

an unofficial @stylexjs vite support
MIT License
48 stars 3 forks source link

Bundle size increased and slow after upgrading to `0.8` #31

Open hrasoa opened 1 week ago

hrasoa commented 1 week ago

Cannot share a repro as it is a large private project, but heres a video: https://youtu.be/BbROxmWa0CI

I use ~ alias everywhere to import my styles.

vite.config.ts

import { resolve, join } from 'path';
import { TanStackRouterVite } from '@tanstack/router-vite-plugin';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { stylex } from 'vite-plugin-stylex-dev';

// https://vitejs.dev/config/
export default defineConfig(async () => ({
  plugins: [
    react({
      babel: {
        plugins: ['relay'],
      },
    }),
    stylex({
      unstable_moduleResolution: {
        type: 'commonJS',
        rootDir: resolve(__dirname, 'src'),
      },
    }),
    TanStackRouterVite(),
  ],
  resolve: {
    alias: [
      {
        find: '~',
        replacement: join(resolve(__dirname), 'src'),
      },
    ],
  },

  // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
  //
  // 1. prevent vite from obscuring rust errors
  clearScreen: false,
  // 2. tauri expects a fixed port, fail if that port is not available
  server: {
    port: 1420,
    strictPort: true,
    watch: {
      // 3. tell vite to ignore watching `src-tauri`
      ignored: ['**/src-tauri/**'],
    },
  },
}));
emilgpa commented 1 week ago

I confirm that version 0.8 is much slower. It takes me between 17 and 20 seconds. With the previous 0.7.5, a second and a bit.

hipstersmoothie commented 1 week ago

My project won't start anymore, just hangs. Mine is public if you want to try it out

nonzzz commented 1 week ago

Please stay on 0.7.5 for a while and don't bump to 0.8. I'm current focus on the problem.

hrasoa commented 1 week ago

sure, take your time 👍