Skip to content

Commit

Permalink
fix(runtime): 使用vue-demi cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed May 31, 2024
1 parent b198417 commit 0cd8382
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 56 deletions.
16 changes: 8 additions & 8 deletions runtime/vue2/build.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`,
Expand All @@ -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'],
},
},
};
}
Expand Down
20 changes: 4 additions & 16 deletions runtime/vue2/dev.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
});
5 changes: 4 additions & 1 deletion runtime/vue2/page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
5 changes: 3 additions & 2 deletions runtime/vue2/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
16 changes: 8 additions & 8 deletions runtime/vue3/build.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`,
Expand All @@ -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'],
},
},
};
}
Expand Down
20 changes: 4 additions & 16 deletions runtime/vue3/dev.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
});
4 changes: 2 additions & 2 deletions runtime/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion runtime/vue3/page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
6 changes: 4 additions & 2 deletions runtime/vue3/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 0cd8382

Please sign in to comment.