Skip to content

Commit 269121e

Browse files
authored
feat(plugin-vue): expose options in api (#177)
1 parent b8dbcb4 commit 269121e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/plugin-vue/src/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type {
1010
} from 'vue/compiler-sfc'
1111
import type * as _compiler from 'vue/compiler-sfc'
1212
/* eslint-enable import/no-duplicates */
13+
import { version } from '../package.json'
1314
import { resolveCompiler } from './compiler'
1415
import { parseVueRequest } from './utils/query'
1516
import { getDescriptor, getSrcDescriptor } from './utils/descriptorCache'
@@ -130,6 +131,16 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
130131
return {
131132
name: 'vite:vue',
132133

134+
api: {
135+
get options() {
136+
return options
137+
},
138+
set options(value) {
139+
options = value
140+
},
141+
version,
142+
},
143+
133144
handleHotUpdate(ctx) {
134145
if (options.compiler.invalidateTypeCache) {
135146
options.compiler.invalidateTypeCache(ctx.file)

packages/plugin-vue/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"noImplicitOverride": true,
1313
"noUnusedLocals": true,
1414
"esModuleInterop": true,
15-
"baseUrl": "."
15+
"baseUrl": ".",
16+
"resolveJsonModule": true
1617
}
1718
}

0 commit comments

Comments
 (0)