Skip to content

Commit

Permalink
feat: 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
haixin-fang committed Mar 14, 2024
1 parent 1673301 commit 8f454be
Show file tree
Hide file tree
Showing 6 changed files with 655 additions and 274 deletions.
16 changes: 8 additions & 8 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starfish-editor",
"version": "1.1.9",
"version": "1.1.11",
"main": "dist/starfish-editor.umd.js",
"style": "dist/style.css",
"module": "dist/starfish-editor.es.js",
Expand All @@ -20,22 +20,22 @@
},
"dependencies": {
"@babel/core": "^7.18.5",
"@codemirror/lang-css": "^6.0.0",
"@codemirror/lang-html": "^6.1.0",
"@codemirror/lang-javascript": "^6.0.2",
"@codemirror/lang-json": "^6.0.0",
"@codemirror/lang-css": "6.0.0",
"@codemirror/lang-html": "6.1.0",
"@codemirror/lang-javascript": "6.0.2",
"@codemirror/lang-json": "6.0.0",
"clipboard": "^2.0.11",
"codemirror": "^6.0.1",
"codemirror": "6.0.1",
"core-js": "^3.6.5",
"element-plus": "^2.2.12",
"gesto": "^1.9.0",
"jsoneditor": "^9.9.0",
"keycon": "^1.1.2",
"mitt": "^3.0.0",
"nanoid": "^4.0.0",
"starfish-form": "^1.2.6",
"starfish-form": "^1.2.7",
"vue": "^3.2.37",
"vue-codemirror": "^6.1.1",
"vue-codemirror": "6.1.1",
"vuedraggable": "^4.1.0",
"wangeditor": "^4.7.15"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/form/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ declare module 'vue' {
JsonEditor: typeof import('./src/components/JsonEditor/index.vue')['default']
Radio: typeof import('./src/components/Radio/index.vue')['default']
RichText: typeof import('./src/components/RichText/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Rule: typeof import('./src/components/Rule/index.vue')['default']
Selected: typeof import('./src/components/Selected/index.vue')['default']
Selecteds: typeof import('./src/components/Selecteds/index.vue')['default']
Expand Down
8 changes: 4 additions & 4 deletions packages/form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starfish-form",
"version": "1.2.6",
"version": "1.2.7",
"main": "dist/starfish-form.mjs",
"style": "dist/style.css",
"module": "dist/starfish-form.mjs",
Expand All @@ -24,9 +24,9 @@
"vue": "^3.2.25",
"@element-plus/icons-vue": "^2.0.8",
"wangeditor": "^4.7.15",
"vue-codemirror": "^6.1.1",
"codemirror": "^6.0.1",
"@codemirror/lang-javascript": "^6.0.2"
"vue-codemirror": "6.1.1",
"codemirror": "6.0.1",
"@codemirror/lang-javascript": "6.0.2"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.3.3",
Expand Down
4 changes: 2 additions & 2 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"dependencies": {
"@element-plus/icons-vue": "^2.0.8",
"element-plus": "^2.2.12",
"starfish-editor": "^1.1.9",
"starfish-form": "^1.2.6",
"starfish-editor": "^1.1.11",
"starfish-form": "^1.2.7",
"vite": "^4.5.2",
"vue": "^3.2.37",
"vue-router": "^4.1.3"
Expand Down
27 changes: 20 additions & 7 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const alias: any = [
replacement: path.resolve(__dirname, "../packages/editor/src/components"),
},
];
console.log(process.env.NODE_ENV)
console.log(process.env.NODE_ENV);
if (process.env.NODE_ENV != "production") {
alias.push({
find: /^starfish-form\/dist\/style.css/,
Expand Down Expand Up @@ -86,12 +86,12 @@ export default defineConfig({
sourcemap: false, // 构建后是否生成 source map 文件。如果为 true,将会创建一个独立的 source map 文件
target: "esnext", // 设置最终构建的浏览器兼容目标。默认值是一个 Vite 特有的值——'modules' 还可设置为 'es2015' 'es2016'等
minify: "esbuild", // 'terser' 相对较慢,但大多数情况下构建后的文件体积更小。'esbuild' 最小化混淆更快但构建后的文件相对更大。
terserOptions: {
compress: {
drop_console: true, // 生产环境去除console
drop_debugger: true, // 生产环境去除debugger
},
},
// terserOptions: {
// compress: {
// drop_console: true, // 生产环境去除console
// drop_debugger: true, // 生产环境去除debugger
// },
// },
// outDir,
rollupOptions: {
input: {
Expand All @@ -101,6 +101,19 @@ export default defineConfig({
chunkFileNames: "static/js/[name]-[hash].js",
entryFileNames: "static/js/[name]-[hash].js",
assetFileNames: "static/[ext]/[name]-[hash].[ext]",
manualChunks: (id) => {
// 这个ID,就是所有文件的绝对路径
if (id.includes("element-plus")) {
// 因为 node_modules 中的依赖通常是不会改变的
// 所以直接单独打包出去
// 这个return 的值就是打包的名称
return "element-plus";
} else if (id.includes("lodash-es")) {
return "lodash-es";
} else if (id.includes("vue-codemirror")) {
return "vue-codemirror";
}
},
},
},
},
Expand Down
Loading

0 comments on commit 8f454be

Please sign in to comment.