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

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

Open azimidev opened this issue 7 years ago • 11 comments

The code is ok. However you can mix require and export. You can't mix import and module.exports. In your main.js replace this:

import VueAdsense from './VueAdsense.vue'
module.exports = VueAdsense

with this:

import VueAdsense from './VueAdsense.vue'
export default VueAdsense

azimidev avatar Jul 07 '17 18:07 azimidev

Funny - you and I are doing the same work. Just ran in to the same problem. Of course... now I get a 404 error and the ads won't load on the page, but I don't think that's this components fault. That may be a service-worker issue.

Darrynten - I just checked it looks like you fixed it here, but when downloading from npm the error is still present. Just fyi =)

jamesmskelsey avatar Jul 07 '17 19:07 jamesmskelsey

I am working with Vue and it is components fault. Revert your last commit. I did it and it worked

azimidev avatar Jul 07 '17 19:07 azimidev

@jamesmskelsey hi there, does the latest dev work for you but the npm one doesn't?

darrynten avatar Jul 07 '17 21:07 darrynten

@darrynten Yeah man, got the latest dev to work just fine. Heck, what I ended up doing was just manually changing the line that needed changed. When I downloaded it from npm, it was still giving the error from issue 3.

jamesmskelsey avatar Jul 08 '17 02:07 jamesmskelsey

Hi @jamesmskelsey, any chance of a pull request?

Would be amazing ✨

darrynten avatar Jul 26 '17 17:07 darrynten

hey @darrynten, I just installed the package and still can see this error because main.js file is not updated.

Currently, it looks like this:

import VueAdsense from './VueAdsense.vue'
module.exports = VueAdsense

scofield-ua avatar Sep 12 '17 15:09 scofield-ua

Confirmed, this issue still on npm

ShiraMiyuko avatar Nov 23 '17 03:11 ShiraMiyuko

also confirming, still an issue with npm version. repo version works great.

VetSoftKeith avatar Dec 14 '17 03:12 VetSoftKeith

The way to get around this is to:

  1. Fork the repo, so you have control of commits made to master
  2. Install your forked repo by doing: npm install yourusername/vue-adsense#master --save-dev

Done!

craigh411 avatar Apr 03 '18 12:04 craigh411

@craigh411 Yes you are right, im my case I should do npm install git+https://github.com/darrynten/vue-adsense.git, the username/repo option don't work for me.

Take notice that you use --save-dev instead --save, if you use --save-dev the module are only available on development enviroment, you should use --save for vue modules.

MitsuhaKitsune avatar Jul 12 '18 18:07 MitsuhaKitsune

@MitsuhaKitsune I'm glad it helped. I always use --save-dev for npm packages because I bundle them using webpack, so there's no need for them to be on the production server, however, if you aren't bundling them, then you will need to use --save instead.

craigh411 avatar Jul 13 '18 16:07 craigh411