Subscribe on changes!

Invalid after iscustomelement configuration,There are test cases

avatar
Dec 9th 2020

Version

3.0.4

Reproduction link

https://github.com/ht-sauce/vuemini-test

Steps to reproduce

app.config.isCustomElement = tag => tag.startsWith('ion-') A minimum case has been provided according to the requirements in GitHub, please check

What is expected?

There should be no warning

What is actually happening?

There are still warnings

avatar
Dec 11th 2020

Maybe it's not a Vue bug, so I closed my PR. as a workround, edit babel.config.js like this:

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ],
  plugins: [
    /* eslint-disable-next-line global-require */
    [require('@vue/babel-plugin-jsx'), { isCustomElement: tag => /^ion-/.test(tag) }],
  ],
}
avatar
Dec 14th 2020

也许这不是Vue的错误,所以我关闭了PR。 作为工作场所,请像下面这样编辑babel.config.js:

模块。出口 =  {
  预设:[ 
    '@ vue / cli-plugin-babel / preset' 
  ] ,
  插件:[ 
    / * eslint-disable-next-line global-require * / 
    [要求('@ vue / babel-plugin-jsx' ), {  isCustomElement:tag  =>  / ^ ion- / 。测试(标签) } ] ,
  ] ,
}

Thank you. That really solves the problem.

But this configuration does not appear in the official documents, I think there will be a lot of people like me have doubts. Hope to improve the official documents

avatar
Dec 28th 2020

We should probably amend the Vue core docs for app.config.isCustomElement and explain that:

  1. This check only runs for templates compiled at runtime.
  2. a similar option can be configured for templates compiled during build:
  • vue-loader & rollup-plugin-vue (through their compilerOptions)
  • vue's jsx babel plugin
avatar
Dec 30th 2020

@LinusBorg I agree, This problem may often be encountered.

avatar
Mar 21st 2021

Only adding the workaround from @edison1105 didn't work for me. (Reproduction Projekt: https://github.com/florianrusch/Foobar3)

I use @vue/cli. If I understand correctly the PR of @Xenonym (https://github.com/vuejs/docs-next/pull/779) and the note he added to the docs, I have to use vue-loader and thus a custom webpack configuration to set the compiler option. Is that correct? Or is there a way to set the compiler option without using vue-loader/a custom webpack config?

avatar
Mar 21st 2021

I have to use vue-loader and thus a custom webpack configuration to set the compiler option @florianrusch yes

avatar
Jul 5th 2022

This is now documented better: https://vuejs.org/api/application.html#app-config-compileroptions

Closing this