fengyuanchen / vue-carousel

Carousel component for Vue.js.
https://fengyuanchen.github.io/vue-carousel/
MIT License
188 stars 34 forks source link

Simple example does not work in vuepress #1

Closed DaleMatthews closed 5 years ago

DaleMatthews commented 6 years ago

Trying to use this component in vuepress and I am getting this error

vue.runtime.esm.js?2b0e:587 [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

found in

---> <Anonymous>
       <Carousel> at C:\Users\Felix\Projects\Phoenix\vue-carousel\src\index.vue
         <AboutMe> at src/.vuepress/components/about-me.vue
           <V5103d6244901e> at src/about.md
             <Page> at node_modules/vuepress/lib/default-theme/Page.vue
               <Layout> at node_modules/vuepress/lib/default-theme/Layout.vue
                 <Root>

I installed the package using npm as instructed, then tried 1) registering the component globally in enhanceApp.js 2) or importing it directly into my about-me component and registering it there

I assume the issue has to do with how you're building to your dist dir. I see some potentially useful info here: https://github.com/vuejs-templates/webpack/issues/215

fengyuanchen commented 6 years ago

Import vue.esm.js instead of vue.runtime.esm.js.

DaleMatthews commented 6 years ago

I'm not importing vue at all.

// enhanceApp.js as defined by vuepress
import VueCarousel from '@chenfengyuan/vue-carousel';

export default ({
  Vue, // the version of Vue being used in the VuePress app
  options, // the options for the root Vue instance
  router, // the router instance for the app
  siteData // site metadata
}) => {
  Vue.component(VueCarousel.name, VueCarousel);
}

I haven't had these issues with other components

fengyuanchen commented 6 years ago

This component requires vue-template-compiler for compiling custom slide content as HTML.

fengyuanchen commented 6 years ago

You should install vue-template-compiler and import vue.esm.js in your vuepress config file.

kjimenezdev commented 5 years ago

I was encountering the same issue, but this doesn't happen whenever the production build is done so.. just you can ignore the warning. Thanks for the carousel component.

taozuhong commented 2 years ago

@fengyuanchen Could you post a minimal working example for adding this to Vuepress?

taozuhong commented 2 years ago

@kjimenezdev could you share the vuepress component?

fengyuanchen commented 2 years ago

@taozuhong Please note that:

taozuhong commented 2 years ago

收到,谢谢分享。 Got it, thanks.