fix(runtime): 使用vue-demi cdn

This commit is contained in:
roymondchen 2024-05-31 20:02:53 +08:00
parent b198417ad1
commit 0cd83825b7
9 changed files with 40 additions and 56 deletions

View File

@ -56,10 +56,10 @@ export default defineConfig(({ mode }) => {
return {
plugins: [
vue(),
externalGlobals({ 'vue-demi': 'VueDemi', vue: 'Vue' }, { exclude: [`./${mode}/index.html`] }),
legacy({
targets: ['defaults', 'not IE 11'],
}),
externalGlobals({ vue: 'Vue' }, { exclude: [`./${mode}/index.html`] }),
],
root: `./${mode}/`,
@ -68,17 +68,17 @@ export default defineConfig(({ mode }) => {
base: `/tmagic-editor/playground/runtime/vue2/${mode}`,
optimizeDeps: {
exclude: ['vue-demi'],
},
build: {
emptyOutDir: true,
sourcemap: true,
outDir: path.resolve(process.cwd(), `../../playground/public/runtime/vue2/${mode}`),
},
resolve: {
alias: [
{ find: /^vue$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm.js') },
{ find: /^vue-demi$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm.js') },
],
rollupOptions: {
external: ['vue', 'vue-demi'],
},
},
};
}

View File

@ -46,25 +46,13 @@ export default defineConfig({
publicDir: 'public',
optimizeDeps: {
exclude: ['vue-demi'],
},
server: {
host: '0.0.0.0',
port: 8078,
strictPort: true,
},
build: {
sourcemap: true,
cssCodeSplit: false,
rollupOptions: {
input: {
page: './page/index.html',
playground: './playground/index.html',
},
output: {
entryFileNames: 'assets/[name].js',
},
},
},
});

View File

@ -25,10 +25,13 @@
display: none;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-demi"></script>
</head>
<body style="font-size: 14px">
<div id="app"></div>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script type="module" src="./main.ts"></script>
</body>
</html>

View File

@ -37,13 +37,14 @@
background-color: rgba(51, 153, 255, 0.5) !important;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-demi"></script>
</head>
<body style="font-size: 14px">
<div id="app" class="in-editor"></div>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script type="module" src="./main.ts"></script>
</body>
</html>

View File

@ -58,10 +58,10 @@ export default defineConfig(({ mode }) => {
plugins: [
vue(),
vueJsx(),
externalGlobals({ 'vue-demi': 'VueDemi', vue: 'Vue' }, { exclude: [`./${mode}/index.html`] }),
legacy({
targets: ['defaults', 'not IE 11'],
}),
externalGlobals({ vue: 'Vue' }, { exclude: [`./${mode}/index.html`] }),
],
root: `./${mode}/`,
@ -70,17 +70,17 @@ export default defineConfig(({ mode }) => {
base: `/tmagic-editor/playground/runtime/vue3/${mode}`,
optimizeDeps: {
exclude: ['vue-demi'],
},
build: {
emptyOutDir: true,
sourcemap: true,
outDir: path.resolve(process.cwd(), `../../playground/public/runtime/vue3/${mode}`),
},
resolve: {
alias: [
{ find: /^vue$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm-bundler.js') },
{ find: /^vue-demi$/, replacement: path.join(__dirname, 'node_modules/vue/dist/vue.esm-bundler.js') },
],
rollupOptions: {
external: ['vue', 'vue-demi'],
},
},
};
}

View File

@ -48,25 +48,13 @@ export default defineConfig({
publicDir: 'public',
optimizeDeps: {
exclude: ['vue-demi'],
},
server: {
host: '0.0.0.0',
port: 8078,
strictPort: true,
},
build: {
sourcemap: true,
cssCodeSplit: false,
rollupOptions: {
input: {
page: './page/index.html',
playground: './playground/index.html',
},
output: {
entryFileNames: 'assets/[name].js',
},
},
},
});

View File

@ -18,11 +18,11 @@
"build:ds:event": "vite build --config build.vite.config.ts --mode ds:event"
},
"dependencies": {
"@tmagic/data-source": "1.4.7",
"@tmagic/core": "1.4.7",
"@tmagic/ui": "1.4.7",
"@tmagic/data-source": "1.4.7",
"@tmagic/schema": "1.4.7",
"@tmagic/stage": "1.4.7",
"@tmagic/ui": "1.4.7",
"@tmagic/utils": "1.4.7",
"@tmagic/vue-runtime-help": "^0.0.3",
"axios": "^0.25.0",

View File

@ -25,11 +25,13 @@
display: none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.4.21/vue.global.prod.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-demi"></script>
</head>
<body style="font-size: 14px">
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.4.21/vue.global.prod.min.js"></script>
<script type="module" src="./main.ts"></script>
</body>
</html>

View File

@ -37,11 +37,13 @@
background-color: rgba(51, 153, 255, 0.5) !important;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.4.21/vue.global.prod.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-demi"></script>
</head>
<body style="font-size: 14px">
<div id="app" class="in-editor"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.4.21/vue.global.prod.min.js"></script>
<script type="module" src="./main.ts"></script>
</body>
</html>