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

Vite 5 is not supported #1211

Open
1 of 2 tasks
wylieconlon opened this issue Sep 27, 2024 · 0 comments
Open
1 of 2 tasks

Vite 5 is not supported #1211

wylieconlon opened this issue Sep 27, 2024 · 0 comments

Comments

@wylieconlon
Copy link

Bug report

When using Vite 5 with Sandpack, it throws this error. There is a workaround using the package.json overrides field, but that workaround is broken in Sandpack.

Uncaught (in promise) Error: Your current platform "linux" and architecture "x32" combination is not yet supported by the native Rollup build. Please use the WASM build "@rollup/wasm-node" instead.

Here is a minimal reproduction (Codesandbox link):

import { SandpackProvider, SandpackPreview } from "@codesandbox/sandpack-react";

export default function App() {
  return (
    <SandpackProvider
      template="vite"
      customSetup={{
        devDependencies: {
          vite: "^5"
        },
      }}
    >
      <SandpackPreview />
    </SandpackProvider>
  );
}

The error message indicates that we should use @rollup/wasm-node to replace rollup, which is documented in the Rollup 4 changelog. But since Rollup is an internal dependency of Vite, we should be able to use a npm "override" like this sample. The problem is that this workaround doesn't work in the sandpack depedency resolver.

import {
  SandpackProvider,
  SandpackPreview,
} from "@codesandbox/sandpack-react";

export function App() {
  return <SandpackProvider
    template="vite"
    files={{
      'package.json': `{
  "name": "vite-template",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite"
  },
  "dependencies": {
    "@vitejs/plugin-react": "^4.3.1",
    "react": "^18",
    "react-dom": "^18",
    "vite": "^5",
    "@rollup/wasm-node": "4.22.5"
  },
  "overrides": {
    "rollup": "npm:@rollup/wasm-node"
  }
}
  `,
  }
  >
    <SandpackPreview />
  </SandpackProvider >
}

Packages affected

  • sandpack-client
  • sandpack-react

Description of the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant