tfoxy / chrome-promise

Promises for chrome JavaScript APIs used in extensions and apps.
MIT License
150 stars 14 forks source link

Issue transpiling chrome-promise.js with Babel 7 #25

Closed Steve06 closed 5 years ago

Steve06 commented 6 years ago

See my repo with minimal code created for illustration purposes:

https://github.com/Steve06/chrome-promise-babel-7-issue-repo

Great projet by the way (and to me superior and more to the point than the alternatives mentioned in the README)

tfoxy commented 6 years ago

Hi Steve!

Thanks for the detailed explanation of the issue. Will try to check it in the following days.

Glad that the project suit your needs better!

tfoxy commented 6 years ago

Hi! I didn't have the time to check this issue. Right now I will be on vacations until December 8th.

Until then, you can try to fix it and publish it to npm with your user scope. What I would do is to find the difference between transpiling the module with Babel 6 and Babel 7. That would give you a clue of what's wrong.

If you are not in a hurry, you can wait for my return.

Steve06 commented 5 years ago

Hey there, no indeed I haven't been able to solve the issue, so if you would like to look into that it would be awesome. Perhaps my repo above helps as a starting point. Best, Steve

Steve06 commented 5 years ago

Hello tfoxy, got any chance to look into this issue? Would be great. Thanks, Steve

tfoxy commented 5 years ago

Hi Steve!

Sorry, I forgot about the issue. The problem is that when webpack is used, the module does not use the window instance. It will assume that you will use it by importing it as a module.

Try adding the following line at the beginning of bg.js:

import ChromePromise from './chrome-promise';

And don't use chrome-promise.js in webpack.config.js and in manifest.json.

EDIT: I released a new version because it was not working after making this change. Install the new version.

tfoxy commented 5 years ago

Closing this for inactivity. If you think this should be open, please comment here.