Skip to content

Commit

Permalink
feat(plugin-vue): expose options in api (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Aug 28, 2023
1 parent b8dbcb4 commit 269121e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
} from 'vue/compiler-sfc'
import type * as _compiler from 'vue/compiler-sfc'
/* eslint-enable import/no-duplicates */
import { version } from '../package.json'
import { resolveCompiler } from './compiler'
import { parseVueRequest } from './utils/query'
import { getDescriptor, getSrcDescriptor } from './utils/descriptorCache'
Expand Down Expand Up @@ -130,6 +131,16 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
return {
name: 'vite:vue',

api: {
get options() {
return options
},
set options(value) {
options = value
},
version,
},

handleHotUpdate(ctx) {
if (options.compiler.invalidateTypeCache) {
options.compiler.invalidateTypeCache(ctx.file)
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"noImplicitOverride": true,
"noUnusedLocals": true,
"esModuleInterop": true,
"baseUrl": "."
"baseUrl": ".",
"resolveJsonModule": true
}
}

0 comments on commit 269121e

Please sign in to comment.