darrynten / vue-adsense

Google Adsense for Vue
MIT License
77 stars 26 forks source link

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

Open azimidev opened 7 years ago

azimidev commented 7 years ago

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
jamesmskelsey commented 7 years ago

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 =)

azimidev commented 7 years ago

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

darrynten commented 7 years ago

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

jamesmskelsey commented 7 years ago

@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.

darrynten commented 7 years ago

Hi @jamesmskelsey, any chance of a pull request?

Would be amazing ✨

scofield-ua commented 7 years ago

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
ShiraMiyuko commented 6 years ago

Confirmed, this issue still on npm

VetSoftKeith commented 6 years ago

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

craigh411 commented 6 years ago

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!

MitsuhaKitsune commented 6 years ago

@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.

craigh411 commented 6 years ago

@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.