vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.66k stars 8.33k forks source link

Runtime-only builds should warn if `app.config.isCustomElement` is used #2936

Closed Xenonym closed 3 years ago

Xenonym commented 3 years ago

Version

3.0.5

Reproduction link

https://codesandbox.io/s/vue3-iscustomelement-warning-reprod-k1rx7

Steps to reproduce

  1. Open the reproduction.
  2. Open the console.

What is expected?

There should be a warning that app.config.isCustomElement has no effect in a runtime-only build, and to configure complierOptions in vue-loader instead.

What is actually happening?

No warning about using app.config.isCustomElement in a runtime-only build is emitted.

Vue still attempts to resolve <custom-element> as a Vue component, and a warning is emitted as it is not a Vue component.


The migration guide suggests that a warning will be emitted if app.config.isCustomElement is used in a runtime-only build:

If config.isCustomElement is assigned to when using a runtime-only build, a warning will be emitted instructing the user to pass the option in the build setup instead

LinusBorg commented 3 years ago

FYI I'm working on a small PR to the docs explaining that this option only affects runtime-compilated templates and requires configuration of its counterpart option in build tooling like vue-loader etc.

Still, this seems like a good idea for a runtime warning.

skirtles-code commented 3 years ago

@LinusBorg I'm not sure if this is the same as what you had in mind but there is already a docs PR along similar lines:

https://github.com/vuejs/docs-next/pull/779

LinusBorg commented 3 years ago

ah, good :)