Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ladle seems to conflict with remix vite plugin #559

Closed
sigma-andex opened this issue Apr 22, 2024 · 4 comments
Closed

Ladle seems to conflict with remix vite plugin #559

sigma-andex opened this issue Apr 22, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@sigma-andex
Copy link

Describe the bug

Ladle fails to start with the following error message when remix is in the vite.config:

[ENOENT: no such file or directory, open '/home/projects/ladle-xmfkzx/node_modules/.pnpm/@ladle+react@4.0.3_@types+node@18.11.18_@types+react@18.0.27_react-dom@18.2.0_react@18.2.0_typescript@5.0.4/node_modules/@ladle/react/typings-for-build/app/package.json'] {
  code: 'ENOENT',
  errno: -2,
  path: '/home/projects/ladle-xmfkzx/node_modules/.pnpm/@ladle+react@4.0.3_@types+node@18.11.18_@types+react@18.0.27_react-dom@18.2.0_react@18.2.0_typescript@5.0.4/node_modules/@ladle/react/typings-for-build/app/package.json',
  syscall: 'open',
  message: "Could not read package.json: Error: ENOENT: no such file or directory, open '/home/projects/ladle-xmfkzx/node_modules/.pnpm/@ladle+react@4.0.3_@types+node@18.11.18_@types+react@18.0.27_react-dom@18.2.0_react@18.2.0_typescript@5.0.4/node_modules/@ladle/react/typings-for-build/app/package.json'"
}

Reproduction

See https://stackblitz.com/edit/ladle-xmfkzx?file=vite.config.ts

Environment

  • Version 4.0.2
@sigma-andex sigma-andex added the needs triage needs to be reviewed label Apr 22, 2024
@tajo
Copy link
Owner

tajo commented May 2, 2024

Any insights what that plugin is doing internally?

@justb3a
Copy link
Contributor

justb3a commented May 6, 2024

Can confirm, I solved it by adding a specific ladle vite config without the remix plugin.

In ~/.vite.config.ts we exported our plugin settings so that we could reuse it in ./.ladle/vite.config.ts.

Use it then with:
"dev:ladle": "ladle dev --viteConfig ./.ladle/vite.config.ts"

Would love to solve the issue, this is more a work around.

@andychongyz
Copy link

Seems like Remix are aware of the issue, see here.

For now I just follow the Storybook way by exclude the remix plugin if I'm running the ladle CLI

const isLadle = process.argv[1]?.includes("ladle");

export default defineConfig({
  server: {
    port: 8081
  },
  // https://remix.run/docs/en/main/future/vite#plugin-usage-with-other-vite-based-tools-eg-vitest-storybook
  // refer to the link above to understand why we use process.env.VITEST or isLadle
  plugins: [
     !isLadle && remix(remixConfig),
    ...

@tajo
Copy link
Owner

tajo commented May 30, 2024

I guess this is not something we can fix on our side. People should follow their advice of excluding it for now as @andychongyz suggests.

@tajo tajo closed this as completed May 30, 2024
@tajo tajo added documentation Improvements or additions to documentation and removed needs triage needs to be reviewed labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants