Skip to content

Commit

Permalink
Merge pull request #291 from YeungHoiChiu/vite-config
Browse files Browse the repository at this point in the history
fix: 打包错误、公共步骤中未禁用分组拖拽导致出现预期之外的结果
  • Loading branch information
ZhouYixun authored Aug 9, 2024
2 parents 89effa6 + b0b3b02 commit 76da2d4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/components/PublicStepUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ const jump = (id) => {
<el-tab-pane :label="$t('pubSteps.selected')" name="select">
<step-draggable
:is-edit="true"
:is-public-steps="true"
:steps="publicStep.steps"
@set-parent="setParent"
@add-step="addStep"
Expand Down
6 changes: 5 additions & 1 deletion src/components/StepDraggable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
isPublicSteps: {
type: Boolean,
default: false, // 公共步骤可能会引用多个不同case的步骤,不应该允许拖拽更改parentId
},
parentId: Number, // 用于分组拖拽时,更新step数据的parentId
});
const emit = defineEmits([
Expand Down Expand Up @@ -163,7 +167,7 @@ const addStepTotarget = (id, toNext) => {
<VueDraggableNext
tag="div"
:list="steps"
group="case-step"
:group="isPublicSteps ? '' : 'case-step'"
handle=".handle"
animation="200"
force-fallback="true"
Expand Down
45 changes: 25 additions & 20 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
import {defineConfig} from 'vite';
import {join} from 'path';
import { defineConfig } from 'vite';
import { join } from 'path';
import vue from '@vitejs/plugin-vue';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server:{
port: 3002
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
return id.toString().split('node_modules/')[1].split('/')[0].toString();
}
}
}
}
},
resolve: {
alias: {
'@': join(__dirname, 'src'),
plugins: [vue()],
server: {
port: 3002,
},
build: {
chunkSizeWarningLimit: 600 * 1024, // 设置警告阈值为600KiB,因为element-plus超过500kb导致打包失败
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
return id
.toString()
.split('node_modules/')[1]
.split('/')[0]
.toString();
}
},
},
},
},
resolve: {
alias: {
'@': join(__dirname, 'src'),
},
},
});

0 comments on commit 76da2d4

Please sign in to comment.