n1crack / vuefinder

Empower your Vue.js applications with this versatile and customizable file manager component, simplifying file organization and navigation.
https://vuefinder.ozdemir.be
MIT License
259 stars 75 forks source link

nuxt3 support #69

Open ganiipek opened 3 months ago

ganiipek commented 3 months ago

I am developing an application for Nuxt 3. Vuefinder works with both frontend and backend api. But when I import it as vuefinder as plugin, I get an error.

plugins/vue-finder.ts

import "vuefinder/dist/style.css";
import VueFinder from "vuefinder/dist/vuefinder";

export default defineNuxtPlugin(async (nuxtApp) => {
  nuxtApp.vueApp.component("vue-finder", VueFinder);
});

Error: require() of ES Module C:\Users\x-pt1\Desktop\programlar\vuefinder-nuxt3\node_modules\@uppy\core\lib\index.js from C:\Users\x-pt1\Desktop\programlar\vuefinder-nuxt3\node_modules\vuefinder\dist\vuefinder.cjs not supported. Instead change the require of index.js in C:\Users\x-pt1\Desktop\programlar\vuefinder-nuxt3\node_modules\vuefinder\dist\vuefinder.cjs to a dynamic import() which is available in all CommonJS modules.

chupacabramiamor commented 3 months ago

Try this:

import VueFinder from 'vuefinder/dist/vuefinder';

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(VueFinder);
});