Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning when using custom elements #153

Closed
ais-one opened this issue May 15, 2020 · 3 comments
Closed

Warning when using custom elements #153

ais-one opened this issue May 15, 2020 · 3 comments

Comments

@ais-one
Copy link
Contributor

ais-one commented May 15, 2020

Describe the bug

There is a warning when using HTML custom elements.

image

I tried using the following

    app.config.isCustomElement = tag => {
      console.log('tag', tag)
      return tag === 'vaadin-button'
    }

but the warning still appears. Also the isCustomElement function is not called

Reproduction

Steps

git clone https://github.com/ais-one/vite-eg
cd vite-eg
npm i
npx snowpack
npm run serve

System Info

  • required vite version: 0.14.4
  • required Operating System: Windows
  • required Node version: 12.16.3
  • Optional:
    • npm/yarn version
    • Installed vue version (from yarn.lock or package-lock.json)
    • Installed @vue/compiler-sfc version

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
vite:server server ready in 254ms. +0ms
  vite:hmr ws client connected +0ms
  vite:hmr ws client connected +11ms
  vite:history redirecting / to /index.html +0ms
  vite:history redirecting / to /index.html +4ms
  vite:hmr ws client connected +14ms
  vite:history redirecting / to /index.html +14ms
  vite:rewrite /index.html: rewriting +0ms
  vite:rewrite     "vue" --> "/@modules/vue" +2ms
  vite:hmr         /index.html imports /@modules/vue +13ms
  vite:rewrite     "./App.vue" --> "/App.vue" +2ms
  vite:hmr         /index.html imports /App.vue +1ms
  vite:hmr ws client connected +3ms
  vite:hmr serving hmr client +34ms
  vite:resolve (vue) vue -> node_modules\@vue\runtime-dom\dist\runtime-dom.esm-bundler.js +0ms
  vite:rewrite (skipped) /@hmr +53ms
  vite:rewrite /@modules/vue: rewriting +5ms
  vite:rewrite     "@vue/runtime-core" --> "/@modules/@vue/runtime-core" +5ms
  vite:hmr         /@modules/vue imports /@modules/@vue/runtime-core +27ms
  vite:rewrite     "@vue/runtime-core" --> "/@modules/@vue/runtime-core" +1ms
  vite:hmr         /@modules/vue imports /@modules/@vue/runtime-core +1ms
  vite:rewrite     "@vue/shared" --> "/@modules/@vue/shared" +2ms
  vite:hmr         /@modules/vue imports /@modules/@vue/shared +1ms
  vite:hmr ws client connected +1ms
  vite:sfc C:\Users\user\test\vite-eg\App.vue parsed in 8ms. +0ms
  vite:resolve (vue) @vue/runtime-core -> node_modules\@vue\runtime-core\dist\runtime-core.esm-bundler.js +37ms
  vite:resolve (vue) @vue/shared -> node_modules\@vue\shared\dist\shared.esm-bundler.js +1ms
  vite:rewrite /@modules/@vue/shared: no imports found. +18ms
  vite:rewrite /@modules/@vue/runtime-core: rewriting +4ms
  vite:rewrite     "@vue/reactivity" --> "/@modules/@vue/reactivity" +10ms
  vite:hmr         /@modules/@vue/runtime-core imports /@modules/@vue/reactivity +31ms
  vite:rewrite     "@vue/reactivity" --> "/@modules/@vue/reactivity" +1ms
  vite:hmr         /@modules/@vue/runtime-core imports /@modules/@vue/reactivity +4ms
  vite:rewrite     "@vue/shared" --> "/@modules/@vue/shared" +3ms
  vite:hmr         /@modules/@vue/runtime-core imports /@modules/@vue/shared +0ms
  vite:resolve (web_modules) @vaadin/vaadin-button -> web_modules\@vaadin\vaadin-button.js +23ms
  vite:sfc C:\Users\user\test\vite-eg\App.vue parse cache hit +38ms
  vite:sfc /App.vue template compiled in 17ms. +18ms
  vite:resolve (vue) @vue/reactivity -> node_modules\@vue\reactivity\dist\reactivity.esm-bundler.js +30ms
  vite:rewrite /@modules/@vue/reactivity: rewriting +34ms
  vite:rewrite     "@vue/shared" --> "/@modules/@vue/shared" +1ms
  vite:hmr         /@modules/@vue/reactivity imports /@modules/@vue/shared +41ms
  vite:rewrite /@modules/@vaadin/vaadin-button: no imports found. +12ms
  vite:sfc C:\Users\user\test\vite-eg\App.vue parse cache hit +61ms
  vite:sfc /App.vue style compiled in 59ms +60ms
@yyx990803
Copy link
Member

https://github.com/vuejs/rfcs/blob/master/active-rfcs/0009-global-api-change.md#configignoredelements---configiscustomelement

See the note about when pre compiling templates. Use vueCompilerOptions in a vite config file to specify that.

@ais-one
Copy link
Contributor Author

ais-one commented May 15, 2020

Thank you...

It works...

added the file vite.config.js with contents below...

module.exports = {
  vueCompilerOptions: {
    isCustomElement: tag => tag.startsWith('vaadin-')
  }
}

@akauppi
Copy link
Contributor

akauppi commented Feb 8, 2021

For Vite 2.x, isCustomElement has been moved to the Vue plugin.

plugins: [vue({
    template: {
      compilerOptions: {
        isCustomElement: () => true
      }
    }
  })]

Source: #1312

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants