vue-final / vue-final-modal

🍕Vue Final Modal is a tiny, renderless, mobile-friendly, feature-rich modal component for Vue.js.
https://vue-final-modal.org
MIT License
862 stars 95 forks source link

The requested module is a CommonJS module #404

Closed nivv closed 7 months ago

nivv commented 7 months ago

Version

vue-final-modal: ^4.4.5 vue: ^3.2.41

OS

Mac

When building with SSR support via Inertia Vite logs the following error:

file:///project/bootstrap/ssr/assets/Show-76caa3ba.mjs:4
import { useVfm, VueFinalModal } from "vue-final-modal";
                 ^^^^^^^^^^^^^
SyntaxError: Named export 'VueFinalModal' not found. The requested module 'vue-final-modal' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'vue-final-modal';
const { useVfm, VueFinalModal } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
    at async j (file:///Users/albin/code/watt-a-day.se/node_modules/@inertiajs/vue3/dist/index.esm.js:1:5861)
    at async Server.<anonymous> (file:///Users/albin/code/watt-a-day.se/node_modules/@inertiajs/core/dist/server.esm.js:1:527)
hunterliu1003 commented 7 months ago

Will be fixed in v4.5