feat(compiler-sfc): add vapor option to script
This commit is contained in:
parent
2486d991f1
commit
afa7ee2fb1
|
@ -124,6 +124,10 @@ export interface SFCScriptCompileOptions {
|
|||
* Transform Vue SFCs into custom elements.
|
||||
*/
|
||||
customElement?: boolean | ((filename: string) => boolean)
|
||||
/**
|
||||
* Force to use of Vapor mode.
|
||||
*/
|
||||
vapor?: boolean
|
||||
}
|
||||
|
||||
export interface ImportBinding {
|
||||
|
@ -153,11 +157,12 @@ export function compileScript(
|
|||
}
|
||||
|
||||
const ctx = new ScriptCompileContext(sfc, options)
|
||||
const { script, scriptSetup, source, filename, vapor } = sfc
|
||||
const { script, scriptSetup, source, filename } = sfc
|
||||
const hoistStatic = options.hoistStatic !== false && !script
|
||||
const scopeId = options.id ? options.id.replace(/^data-v-/, '') : ''
|
||||
const scriptLang = script && script.lang
|
||||
const scriptSetupLang = scriptSetup && scriptSetup.lang
|
||||
const vapor = sfc.vapor || options.vapor
|
||||
|
||||
let refBindings: string[] | undefined
|
||||
|
||||
|
@ -920,6 +925,9 @@ export function compileScript(
|
|||
: `export default`
|
||||
|
||||
let runtimeOptions = ``
|
||||
if (vapor) {
|
||||
runtimeOptions += `\n vapor: true,`
|
||||
}
|
||||
if (!ctx.hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
|
||||
const match = filename.match(/([^/\\]+)\.\w+$/)
|
||||
if (match) {
|
||||
|
|
|
@ -96,6 +96,7 @@ const sfcOptions = computed(
|
|||
inlineTemplate: productionMode.value,
|
||||
isProd: productionMode.value,
|
||||
propsDestructure: true,
|
||||
vapor: useVaporMode.value,
|
||||
},
|
||||
style: {
|
||||
isProd: productionMode.value,
|
||||
|
|
Loading…
Reference in New Issue