aidenybai / million

Optimize React performance and make your React 70% faster in minutes, not months.
https://million.dev
MIT License
15.89k stars 558 forks source link

Remix SPA fails #987

Closed toyamarodrigo closed 3 months ago

toyamarodrigo commented 4 months ago

What version of million are you using?

3.0.5

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Chromium (Arc)

Describe the Bug

I started a project from zero using the Remix SPA Mode template

npx create-remix@latest --template remix-run/remix/templates/spa

installed million and added automatic mode

npx million@latest
export default defineConfig({
  plugins: [million.vite({ auto: true }), react()],
});

CleanShot 2024-03-07 at 00 08 57@2x

{
  "@remix-run/node": "^2.8.0",
  "@remix-run/react": "^2.8.0",
  "million": "^3.0.5",
  "react": "^18.2.0",
  "react-dom": "^18.2.0"
}

What's the expected result?

It should show the remix starter page

CleanShot 2024-03-07 at 00 11 33@2x

Link to Minimal Reproducible Example

https://stackblitz.com/~/github.com/toyamarodrigo/test-remix-spa

Participation

github-actions[bot] commented 4 months ago

Thanks for opening this issue! A maintainer will review it soon.

toyamarodrigo commented 4 months ago

Seems to work on 3.0.3 and 3.0.2 but not

tobySolutions commented 4 months ago

Hey there @toyamarodrigo, can you try setting the rsc value in the compiler options to true? You should end up with something like this in Vite config:

import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import million from "million/compiler";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
  plugins: [
    million.vite({ auto: true, rsc: true }),
    remix({
      ssr: false,
    }),
    tsconfigPaths(),
  ],
});
tobySolutions commented 4 months ago

I reported it to core team as well and work is being done to resolve the issues you're having. Thank you @toyamarodrigo

toyamarodrigo commented 4 months ago

Hey there @toyamarodrigo, can you try setting the rsc value in the compiler options to true? You should end up with something like this in Vite config:

import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import million from "million/compiler";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
  plugins: [
    million.vite({ auto: true, rsc: true }),
    remix({
      ssr: false,
    }),
    tsconfigPaths(),
  ],
});

It seems to work with rsc: true, but is that property supposed to be added in spa mode? 🤔