fix(compiler-sfc): <script setup>
warning
The warning was showing even if the component is only using a classic `<script>`
This commit is contained in:
parent
5f61aa0f71
commit
9146cc485e
@ -457,7 +457,7 @@ describe('SFC compile <script setup>', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('error on duplicated defalut export', () => {
|
test('error on duplicated default export', () => {
|
||||||
expect(
|
expect(
|
||||||
parse(`
|
parse(`
|
||||||
<script>
|
<script>
|
||||||
|
@ -40,15 +40,17 @@ export function compileScript(
|
|||||||
sfc: SFCDescriptor,
|
sfc: SFCDescriptor,
|
||||||
options: SFCScriptCompileOptions = {}
|
options: SFCScriptCompileOptions = {}
|
||||||
): SFCScriptBlock {
|
): SFCScriptBlock {
|
||||||
if (__DEV__ && !__TEST__ && !hasWarned) {
|
const { script, scriptSetup, styles, source, filename } = sfc
|
||||||
|
|
||||||
|
if (__DEV__ && !__TEST__ && !hasWarned && scriptSetup) {
|
||||||
hasWarned = true
|
hasWarned = true
|
||||||
console.log(
|
// @ts-ignore `console.info` cannot be null error
|
||||||
|
console[console.info ? 'info' : 'log'](
|
||||||
`\n[@vue/compiler-sfc] <script setup> is still an experimental proposal.\n` +
|
`\n[@vue/compiler-sfc] <script setup> is still an experimental proposal.\n` +
|
||||||
`Follow https://github.com/vuejs/rfcs/pull/182 for its status.\n`
|
`Follow https://github.com/vuejs/rfcs/pull/182 for its status.\n`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { script, scriptSetup, styles, source, filename } = sfc
|
|
||||||
const hasCssVars = styles.some(s => typeof s.attrs.vars === 'string')
|
const hasCssVars = styles.some(s => typeof s.attrs.vars === 'string')
|
||||||
|
|
||||||
const isTS =
|
const isTS =
|
||||||
|
Loading…
Reference in New Issue
Block a user