File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ import { globalAttrs, globalProps } from './index'
1717
1818export type Mode = 'tree' | 'text'
1919
20+ const name = 'JsonEditorVue'
2021const modelValueProp = isVue3 ? 'modelValue' : 'value'
2122const updateModelValue = isVue3 ? 'update:modelValue' : 'input'
22-
2323const boolAttrs = [
2424 'mainMenuBar' ,
2525 'navigationBar' ,
@@ -30,7 +30,7 @@ const boolAttrs = [
3030]
3131
3232export default defineComponent ( {
33- name : 'JsonEditorVue' ,
33+ name,
3434 props : {
3535 [ modelValueProp ] : { } ,
3636 mode : {
@@ -166,3 +166,5 @@ export default defineComponent({
166166 return ( ) => h ( 'div' , { ref : 'jsonEditorRef' } )
167167 } ,
168168} )
169+
170+ export { name }
Original file line number Diff line number Diff line change 11import type { ConfigEnv , UserConfigExport } from 'vite'
22import dts from 'vite-plugin-dts'
33import { name } from './package.json'
4+ import { name as globalVariableName } from './src/Component'
45
56// https://vitejs.dev/config/
67export default ( { command } : ConfigEnv ) : UserConfigExport => {
@@ -10,18 +11,16 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
1011 name,
1112 entry : 'src/index.ts' ,
1213 } ,
14+ sourcemap : true ,
1315 rollupOptions : {
1416 external : [
1517 'vanilla-jsoneditor' ,
1618 'vue' ,
1719 'vue-demi' ,
1820 ] ,
1921 output : {
20- // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
2122 globals : {
22- 'vanilla-jsoneditor' : 'JSONEditor' ,
23- 'vue' : 'Vue' ,
24- 'vue-demi' : 'VueDemi' ,
23+ [ name ] : globalVariableName ,
2524 } ,
2625 } ,
2726 } ,
You can’t perform that action at this time.
0 commit comments