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

@click events not firing when built for production #60

Open
vslavov opened this issue Oct 16, 2019 · 3 comments
Open

@click events not firing when built for production #60

vslavov opened this issue Oct 16, 2019 · 3 comments

Comments

@vslavov
Copy link

vslavov commented Oct 16, 2019

Describe the bug
I am using vue-owl-carousel and vue-scrollto. Both plugins work fine in dev, but break in production. I thought the issue was tree shaking (or something else related to the plugins not being included in the final build), however inspecting the source reveals they are both included.

I tried something else - attaching @click event with window.scrollTo and I got the same effect - works in dev, not in production. I believe the two issues are related and fixing one would fix the other (or at least I hope so).
Additional context

"vue": "^2.6.10",
    "vue-owl-carousel": "^2.0.3",
    "vue-router": "^3.0.3",
    "vue-scrollto": "^2.17.1"

main.js

import Vue from "vue";
import App from "./App.vue";
import router from './router';
import VueScrollTo from 'vue-scrollto';


Vue.config.productionTip = false;

Vue.use(VueScrollTo, {
  container: "body",
  duration: 500,
  easing: "ease",
  offset: 0,
  force: true,
  cancelable: true,
  onStart: false,
  onDone: false,
  onCancel: false,
  x: false,
  y: true
})

new Vue({
  el: '#app',
  router,
  VueScrollTo,
  render: h => h(App),
  mounted: () => document.dispatchEvent(new Event("x-app-rendered")),
})

vue.config.js

module.exports = {
  pluginOptions: {
    prerenderSpa: {
      registry: undefined,
      renderRoutes: [
        '/civil-engineering',
        '/',
      ],
      useRenderEvent: true,
      headless: true,
      onlyProduction: true
    }
  }
}

@vslavov
Copy link
Author

vslavov commented Oct 16, 2019

Further research - added a window.scrollTo in a mounted hook that works in dev, but not in production. 'Console log' is fine in both dev and production.

PS: Woops, closed by mistake.

@vslavov vslavov closed this as completed Oct 16, 2019
@vslavov vslavov reopened this Oct 16, 2019
@ann8355
Copy link

ann8355 commented Jun 14, 2021

@vslavov have you find how to fix it?
i got the same problem. the @click event work in dev but not in production

@vslavov
Copy link
Author

vslavov commented Jun 14, 2021

@ann8355 no, I remember banging my head for a couple more hours and looking for a whole different approach for my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants