vue-swing icon indicating copy to clipboard operation
vue-swing copied to clipboard

[Feature Request] Vue 3 Support

Open cgarofalo opened this issue 4 years ago • 7 comments

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

cgarofalo avatar Jan 14 '21 22:01 cgarofalo

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

iantearle avatar Aug 16 '21 14:08 iantearle

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!

bramchi avatar Jan 28 '22 16:01 bramchi

@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

just-the-v avatar Oct 29 '22 16:10 just-the-v

@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?

bramchi avatar Oct 31 '22 09:10 bramchi

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

just-the-v avatar Nov 02 '22 17:11 just-the-v

@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?

bramchi avatar Nov 03 '22 07:11 bramchi

@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.

dustydust avatar Mar 31 '23 18:03 dustydust