Maronato / vue-toastification

Vue notifications made easy!
https://vue-toastification.maronato.dev
MIT License
3.13k stars 142 forks source link

Uncaught TypeError: "exports" is read-only #300

Open sundayz opened 2 years ago

sundayz commented 2 years ago

Versions

Describe the bug

In vue-toastification/composition/nuxt/index.js the line module.exports = { useToast }; causes an error on page load.

Uncaught TypeError: "exports" is read-only

const { useContext } = require("@nuxtjs/composition-api"); // eslint-disable-line @typescript-eslint/no-var-requires
export const useToast = () => useContext().app.$toast;

// Commenting this out fixes the problem, because useToast is being exported above anyway
module.exports = { useToast };

Is there a webpack/nuxt/typescript configuration option that fixes this?

Your Environment

sundayz commented 2 years ago

Wouldn't export { useToast as default, useToast } work? (Even though I don't see why it is using a default export here)

ibrahimBeladi commented 2 years ago

I am also facing this issue with nuxt (and compostion api) Any workarounds?