smzapp
smzapp

Reputation: 829

Import vuejs components inside wordpress theme

I am creating a wordpress site with vuejs framework. I am about to put vuejs components into this directory.

wp-content/themes/{theme}/components

The problem is, I can't import vuejs components with ES6 import App from './components/App.vue' functionality.

I tried using CDN but I don't know how importing of components works.

Does anybody know?

Upvotes: 0

Views: 600

Answers (1)

Cosimo Chellini
Cosimo Chellini

Reputation: 1730

the are 2 main solutions for this problem:

  • (best): compile your project (for example with the vue-CLI) in such a way that all imports used in the project are compiled into simple, browser-readable js files
  • use the http-vue-loader library to load components directly from the browser (this solution works perfectly, but in terms of performance with many components it is not recommended)

Upvotes: 1

Related Questions