@bdsoft/element 1.1.15 → 1.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +3 -3
  2. package/package.json +17 -19
  3. package/vite.config.js +48 -31
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as ElementPlus from 'element-plus'
2
- import * as dayjsModule from 'dayjs';
3
- const dayjs = dayjsModule.default || dayjsModule;
2
+ // import * as dayjsModule from 'dayjs';
3
+ // const dayjs = dayjsModule.default || dayjsModule;
4
4
 
5
5
  import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
6
6
  window.ElementPlus = ElementPlus
@@ -81,6 +81,6 @@ export * from './src/utils/index.js'
81
81
  export * from './src/global/index'
82
82
  export * from './src/utils/hookDialog.js'
83
83
  export * from './src/utils/hookPage.js' // 分页hook函数
84
- export { dayjs }
84
+ // export { dayjs }
85
85
  // 导出所有组件
86
86
  export * from './src/index.js'
package/package.json CHANGED
@@ -1,19 +1,17 @@
1
- {
2
- "name": "@bdsoft/element",
3
- "description": "内部UI组件",
4
- "version": "1.1.15",
5
- "type": "module",
6
- "main": "index.js",
7
-
8
- "scripts": {
9
- "dev": "vite",
10
- "build": "vite build",
11
- "preview": "vite preview"
12
- },
13
- "dependencies": {
14
- "@element-plus/icons-vue": "^2.3.2",
15
- "dayjs": "^1.11.19",
16
- "element-plus": "2.13.1",
17
- "splitpanes": "4.0.4"
18
- }
19
- }
1
+ {
2
+ "name": "@bdsoft/element",
3
+ "description": "内部UI组件",
4
+ "version": "1.1.17",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "build": "vite build",
10
+ "preview": "vite preview"
11
+ },
12
+ "dependencies": {
13
+ "@element-plus/icons-vue": "^2.3.2",
14
+ "element-plus": "2.13.1",
15
+ "splitpanes": "4.0.4"
16
+ }
17
+ }
package/vite.config.js CHANGED
@@ -1,58 +1,75 @@
1
- import { defineConfig } from 'vite'
2
- import { fileURLToPath } from 'node:url'
1
+ import { defineConfig } from "vite";
2
+ import { fileURLToPath } from "node:url";
3
3
  // import { resolve } from 'path'
4
- import vueJsx from '@vitejs/plugin-vue-jsx'
5
- import vue from '@vitejs/plugin-vue'
6
- import importToConst from 'rollup-plugin-import-to-const'
4
+ import vueJsx from "@vitejs/plugin-vue-jsx";
5
+ import vue from "@vitejs/plugin-vue";
6
+ import importToConst from "rollup-plugin-import-to-const";
7
7
 
8
- import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
8
+ import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
9
9
 
10
10
  export default defineConfig({
11
11
  resolve: {
12
12
  alias: {
13
- '@': fileURLToPath(new URL('./src', import.meta.url)),
14
- '@utils': fileURLToPath(new URL('./src/utils', import.meta.url)),
15
- 'global': fileURLToPath(new URL('./src/global', import.meta.url)),
16
- '~': fileURLToPath(new URL('./src/assets', import.meta.url))
17
- }
13
+ "@": fileURLToPath(new URL("./src", import.meta.url)),
14
+ "@utils": fileURLToPath(new URL("./src/utils", import.meta.url)),
15
+ global: fileURLToPath(new URL("./src/global", import.meta.url)),
16
+ "~": fileURLToPath(new URL("./src/assets", import.meta.url)),
17
+ },
18
18
  },
19
19
  build: {
20
20
  lib: {
21
- entry: './index.js',
22
- name: '@bdsoft/element',
23
- fileName: 'BdElement', // 输出的包文件名
24
- formats: ['es'] // 这是默认值 'umd','cjs',
21
+ entry: "./index.js",
22
+ name: "@bdsoft/element",
23
+ fileName: "BdElement", // 输出的包文件名
24
+ formats: ["es"], // 这是默认值 'umd','cjs',
25
25
  },
26
26
  // outDir: 'esaaa', // 根输出目录
27
27
  minify: false,
28
28
  rollupOptions: {
29
29
  //忽略打包vue文件
30
- external: ['vue', 'element-plus', '@element-plus/icons-vue', 'vue/server-renderer', '@vue/server-renderer'], // 这里列出你想排除的外部依赖
30
+ external: [
31
+ "vue",
32
+ "element-plus",
33
+ "dayjs",
34
+ "@element-plus/icons-vue",
35
+ "vue/server-renderer",
36
+ "@vue/server-renderer",
37
+ ], // 这里列出你想排除的外部依赖
31
38
  output: [
32
39
  {
33
40
  //配置打包根目录
34
- dir: 'dist',
41
+ dir: "dist",
35
42
  globals: {
36
- vue: 'Vue',
37
- 'element-plus': 'ElementPlus',
38
- '@element-plus/icons-vue': 'ElementPlusIconVue'
43
+ vue: "Vue",
44
+ "element-plus": "ElementPlus",
45
+ "@element-plus/icons-vue": "ElementPlusIconVue",
46
+ dayjs:'dayjs'
39
47
  },
40
- esModule: true // 强制 ES 模块输出格式的兼容性
41
- }
42
- ]
48
+ esModule: true, // 强制 ES 模块输出格式的兼容性
49
+ },
50
+ ],
51
+ },
52
+ // 3. 修复 CommonJS 模块解析(针对 dayjs)
53
+ commonjsOptions: {
54
+ transformMixedEsModules: true, // 自动转换混合模块
55
+ include: [/node_modules\/dayjs/, /node_modules\/element-plus/]
43
56
  },
44
57
  // 优化依赖:提前预构建 dayjs,避免打包时解析错误
45
58
  optimizeDeps: {
46
- include: ['dayjs']
47
- }
59
+ include: ["element-plus"],
60
+ esbuildOptions: {
61
+ define: { global: "globalThis" },
62
+ format: "esm", // 强制 ESM 格式,避免 UMD 冲突
63
+ },
64
+ },
48
65
  },
49
66
  css: {
50
67
  preprocessorOptions: {
51
68
  scss: {
52
- api: 'modern-compiler',
53
- silenceDeprecations: ['legacy-js-api']
54
- }
55
- }
69
+ api: "modern-compiler",
70
+ silenceDeprecations: ["legacy-js-api"],
71
+ },
72
+ },
56
73
  },
57
- plugins: [vue(), vueJsx(), importToConst(), cssInjectedByJsPlugin()]
58
- })
74
+ plugins: [vue(), vueJsx(), importToConst(), cssInjectedByJsPlugin()],
75
+ });