This commit is contained in:
2025-10-17 17:57:50 +08:00
parent c9e5c233a4
commit 5920d93b6b
4 changed files with 477 additions and 369 deletions

View File

@@ -10,26 +10,26 @@
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT",
"packageManager": "pnpm@10.6.2",
"packageManager": "pnpm@10.18.3",
"type": "module",
"devDependencies": {
"@kevisual/types": "^0.0.10",
"@tailwindcss/vite": "^4.1.8",
"@types/node": "^22.15.29",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"@vitejs/plugin-basic-ssl": "^2.0.0",
"@vitejs/plugin-react": "^4.5.1",
"dotenv": "^16.5.0",
"tailwindcss": "^4.1.8",
"vite": "^6.3.5"
"@tailwindcss/vite": "^4.1.14",
"@types/node": "^24.8.1",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"@vitejs/plugin-basic-ssl": "^2.1.0",
"@vitejs/plugin-react": "^5.0.4",
"dotenv": "^17.2.3",
"tailwindcss": "^4.1.14",
"vite": "^7.1.10"
},
"dependencies": {
"@codesandbox/sandpack-react": "^2.20.0",
"clsx": "^2.1.1",
"livecodes": "^0.11.1",
"react": "^19.1.0",
"react-dom": "^19.1.0"
"livecodes": "^0.12.0",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"pnpm": {
"onlyBuiltDependencies": [

780
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
import { createRoot } from 'react-dom/client';
import { App } from './App.tsx';
// import { App } from './App.tsx';
import {AppNode as App} from './sanpack/App.tsx';
createRoot(document.getElementById('root')!).render(<App />);

View File

@@ -25,7 +25,7 @@ export const App = () => {
options={{
showNavigator: true,
// bundlerURL: 'https://sandpack-bundler.vercel.app',
bundlerURL: 'http://localhost:3000',
// bundlerURL: 'http://localhost:3000',
// bundlerURL: 'https://2-19-8-sandpack.codesandbox.io',
}}
files={{
@@ -39,7 +39,41 @@ export const App = () => {
</div>
);
};
export const AppNode = () => {
return (
<div>
<h1>Welcome to the App</h1>
<p>This is a simple React application.</p>
<div>
{/* <SandpackProvider template='react'>
<SandpackLayout>
<SandpackFileExplorer />
<SandpackCodeEditor />
</SandpackLayout>
</SandpackProvider> */}
{/* <SandpackPreviewClient /> */}
<Sandpack
template='node'
// options={{
// layout: 'console', // preview | tests | console
// }}
options={{
showNavigator: true,
layout: 'console',
// bundlerURL: 'https://sandpack-bundler.vercel.app',
// bundlerURL: 'http://localhost:3000',
// bundlerURL: 'https://2-19-8-sandpack.codesandbox.io',
}}
files={{
'/index.js': `console.log("Hello from Node.js Sandpack!");`,
}}
/>
</div>
</div>
);
};
const SandpackPreviewClient: React.FC = () => {
const { sandpack } = useSandpack();
const previewRef = useRef<SandpackPreviewRef>(null);