Skip to content

Issues importing the library in a Nuxt3/Vue3/Vite environment #19

Closed
@patratel

Description

@patratel

Hi,

This might be a very basic issue that I'm simply unable to solve (probably due to lack of knowledge of how wasm works). I'm trying to import the modules into my Vue App in order to encode AVIF files and i'm getting the following error

500 Cannot find module 'C:\Users\cab_l\Desktop\Repositories\wsp-3.0\node_modules\@jsquash\avif\encode' imported from C:\Users\cab_l\Desktop\Repositories\wsp-3.0\node_modules\@jsquash\avif\index.js

I did check the node_modules folder and the module is present thus I have no idea why that might be the case.

My code looks like this

./composables/useUtiles.ts

import { encode } from "@jsquash/avif";

  const convertToAvif = (file) => {
    return new Promise(async (res, rej) => {
      console.log("file ", file);
      const avifBuffer = await encode(file);
      console.log("buffer ", avifBuffer);
      res();
    });
  };

I'm guessing that the issue might be related to this step in the readme file that I'm failing to understand how to proceed with

Note: You will need to either manually include the wasm files from the codec directory or use a bundler like WebPack or Rollup to include them in your app/server.

Any help with this would be greatly appreciated

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions