vue-toastification icon indicating copy to clipboard operation
vue-toastification copied to clipboard

Uncaught TypeError: "exports" is read-only

Open sundayz opened this issue 3 years ago • 2 comments

Versions

  • 1.7.14

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

  • Nuxt 2.15.8 + Nuxt Composition API 0.26.0

sundayz avatar Nov 19 '21 13:11 sundayz

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

sundayz avatar Nov 19 '21 14:11 sundayz

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

ibrahimBeladi avatar Apr 19 '22 11:04 ibrahimBeladi