Browse Source

docs: update sandbox

pull/7512/head
tangjinzhou 7 months ago
parent
commit
35d1de9ea6
  1. 35
      site/src/utils/generateOnlineDemo.ts

35
site/src/utils/generateOnlineDemo.ts

@ -62,19 +62,46 @@ export function getCodeSandboxParams(code: string, meta: Meta): string {
'package.json': { 'package.json': {
content: JSON.stringify({ content: JSON.stringify({
title: meta.title, title: meta.title,
type: 'module',
scripts: {
dev: 'vite',
build: 'vue-tsc --noEmit && vite build',
preview: 'vite preview',
},
dependencies: { dependencies: {
...getDeps(code), ...getDeps(code),
vue: 'next', vue: packageInfo.dependencies.vue,
'ant-design-vue': packageInfo.version, 'ant-design-vue': packageInfo.version,
}, },
devDependencies: { devDependencies: {
'@vue/cli-plugin-babel': '~4.5.0', '@vitejs/plugin-vue': '^3.0.3',
typescript: '^4.0.5', less: '^4.1.3',
typescript: '^4.6.4',
vite: '^3.0.7',
'vue-tsc': '^0.39.5',
}, },
browserslist: ['> 0.2%', 'not dead'],
}), }),
isBinary: false, isBinary: false,
}, },
'vite.config.ts': {
content: `
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
},
},
},
});
`,
isBinary: false,
},
'index.html': { 'index.html': {
content: indexHtml, content: indexHtml,
isBinary: false, isBinary: false,

Loading…
Cancel
Save