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

[Feature Request] Vue 3 Support #32

Open
cgarofalo opened this issue Jan 14, 2021 · 7 comments
Open

[Feature Request] Vue 3 Support #32

cgarofalo opened this issue Jan 14, 2021 · 7 comments

Comments

@cgarofalo
Copy link

It would be great if this package could be updated for use with Vue 3.

@iantearle
Copy link

Try swapping out beforeDestroy for beforeUnmount - works fine with Vue3 following that.

@bramchi
Copy link

bramchi commented Jan 28, 2022

I got a require is undefined error when importing vue-swing into a Vue 3 project.
But managed to fix that by using this CommonJS plugin for Vite.
Now vue-swing works fine in my Vue 3 project 🎈

Hope this helps someone!

@just-the-v
Copy link

@bramchi can you develop a little bit please,
I'm on a quasar project using vite and i just do not understand how to use vite-plugin-commonjs
I'm stuck for 4 days aha

@bramchi
Copy link

bramchi commented Oct 31, 2022

@beeleethebee It has been a while, but I believe I just installed that CommonJS plugin, set it as a plugin in the vite config and then Swing worked. If you follow the instructions from the plugin's readme, you should be good to go. What part are you struggling with?

@just-the-v
Copy link

Hi ! Ty for your answer aha

image

Here is the interesting par of my quasar.config.js

As you can see i really followed the readme provided by vite-commonjs

i also added console.log on viteConfig and viteConf.optimizeDeps.esbuildOptions to be sure that the project build with the options

image

And i see them !

But when i go on my page :

<template>
  <VueSwing
        @throwout="() => console.log('throwout')"
        @throwin="() => console.log('throwin')"
        :config="{}">
        <div style="width: 300px; height: 300px; background-color: black"/>
      </VueSwing>
</template>
<script setup>
import VueSwing from 'vue-swing'
</script>

I have this errors :

image

the div appear but nothings happen.

Do you have any clue ? @bramchi

@bramchi
Copy link

bramchi commented Nov 3, 2022

@beeleethebee My setup was just plain Vue 3 with Swing. I'm not familiar with Quasar.
Maybe you can try to get Swing running without Quasar, to determine if the Quasar context is messing with things.

The ... is not a constructor error feels like a generic one. Have you tried looking for similar issues on the Quasar GitHub, or asking for help there?

@dustydust
Copy link

@beeleethebee the problem is the rebound-js facebook library can't export module in "exports way", because you use Vite, so rebound object store itself in window.rebound

In Stack.js (swing package) you can add something like

var construct = function construct() {
    stack = {};
    _rebound2.default = window.rebound /* added line */
    springSystem = new _rebound2.default.SpringSystem();
    eventEmitter = (0, _sister2.default)();
    index = [];
};

In Card.js you can add something like example above and it will work.

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

5 participants