rubystarashe / nuxt-vuex-localstorage

MIT License
161 stars 18 forks source link

Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' #9

Closed auedbaki closed 4 years ago

auedbaki commented 5 years ago

Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' at Module. (commons.app.js:7813) at Module../node_modules/nuxt-vuex-localstorage/node_modules/axios/lib/utils.js (commons.app.js:7835) at webpack_require (runtime.js:796) at fn (runtime.js:151) at Module. (commons.app.js:6371) at Module../node_modules/nuxt-vuex-localstorage/node_modules/axios/lib/axios.js (commons.app.js:6418) at webpack_require (runtime.js:796) at fn (runtime.js:151) at Object../node_modules/nuxt-vuex-localstorage/node_modules/axios/index.js (commons.app.js:6172) at __webpack_require__ (runtime.js:796)

seanaye commented 5 years ago

I am also getting this error when I include the ie transpile. build: { /* * You can extend webpack config here / transpile: [ 'nuxt-vuex-localstorage' ], extend(config, ctx) {

}

}

I need to have ie compatibility

drewbaker commented 5 years ago

I'm getting a TypeError: "exports" is read-only error with this too. Nuxt version 2.9.2 when I had transpile: ["vuex"], in my nuxt.config.js build function.

Screen Shot 2019-09-13 at 7 08 12 PM

RowEchelonForm commented 5 years ago

I was struggling with the same issue when using the ie transpile. In my case, I was able to fix it by adding sourceType: 'unambiguous' under babel property under build in nuxt.js.config. Like this:

  build: {
    babel: {
      sourceType: 'unambiguous',
    },
    transpile: [
      'nuxt-vuex-localstorage',
    ],
  }

This could cause some other unforeseen issues and I don't really know what it does beyond what it says in Babel documentation: https://babeljs.io/docs/en/options#sourcetype. I'd like to know if there is a better way to fix this, but this seems to work for me.

nelsonlarocca commented 4 years ago

thanks for sharing that fix @RowEchelonForm any advance about that ? I just started getting that problem recently. Currently using Nuxt 2.11

rubystarashe commented 4 years ago

old version nuxt's issue This seems to be solved.