0

In a non Vue3 application this works as expected I am using the Quasarjs framework which runs Vue

  <script type='module'>
    import * as Magick from 'https://knicknic.github.io/wasm-imagemagick/magickApi.js';
    Magick.whatever()
  </script>

How do I get that to work inside a Vue component?

I need it to be a cdn and not a reference to an npm module

dan
  • 2,857
  • 6
  • 34
  • 60
  • 1
    Is your code in a Single File Component? Are you getting errors? Why couldn't it be installed as a npm dependency? – Loris Wit Oct 18 '21 at 09:32
  • Does this answer your question? [How to add external JS scripts to VueJS Components?](https://stackoverflow.com/questions/45047126/how-to-add-external-js-scripts-to-vuejs-components) – Michal Levý Oct 18 '21 at 11:34
  • I went a different direction and used vite which allowed me to import it like above. But yes the link would answer my question, thanks. – dan Oct 18 '21 at 18:29
  • Can you tell me how you imported it? I am trying to do it too, having difficulties with the npm package – Fanna1119 Nov 05 '21 at 06:15
  • I actually switched to wasm-libvips. I like it better but one downside is that you have to configure your server for the SharredArrayBuffer origin. See https://github.com/kleisauke/wasm-vips. For some reason he has not fixed the browser version for npm so I just copied the javascript files from his example. See my repo https://github.com/delebash/unreal_mapbox_bridge. In the public directory are the 3 vip files you need. I added vips to my index.html src="vips.js". Then in code src>components>side-nav. I declaared a vips variable and initialized in mounted, Hope this helps – dan Nov 05 '21 at 23:25

0 Answers0