vue-adsense
vue-adsense copied to clipboard
vue Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
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
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 =)
I am working with Vue and it is components fault. Revert your last commit. I did it and it worked
@jamesmskelsey hi there, does the latest dev work for you but the npm one doesn't?
@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.
Hi @jamesmskelsey, any chance of a pull request?
Would be amazing ✨
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
Confirmed, this issue still on npm
also confirming, still an issue with npm version. repo version works great.
The way to get around this is to:
- Fork the repo, so you have control of commits made to master
- Install your forked repo by doing:
npm install yourusername/vue-adsense#master --save-dev
Done!
@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 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.