-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES modules export doesn't work with rollup #10
Comments
Can you share the relevant parts of your rollup config?
…On Sat, Jul 3, 2021 at 6:26 PM Geoffrey Litt ***@***.***> wrote:
I'm using ExtPay in a project that uses the rollup bundler. I got this
error when running the bundler:
[!] Error: 'runtime' is not exported by node_modules/webextension-polyfill/dist/browser-polyfill.js, imported by node_modules/extpay/dist/ExtPay.module.jshttps://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
node_modules/extpay/dist/ExtPay.module.js <https://rollupjs.org/guide/en/#error-name-is-not-exported-by-modulenode_modules/extpay/dist/ExtPay.module.js> (1:21)
1: import { management, runtime, storage, windows } from 'webextension-polyfill';
For the moment I was able to work around the issue by importing the
commonjs version, which worked great.
I'm not sure if this is just some specific problem with my setup, or might
be a broader issue with the module version of the package. It seems like
webextension-polyfill might have an unusual module export format? From
the readme <https://github.com/mozilla/webextension-polyfill>:
Be aware that the polyfill module does not export the browser API object, but defines the browser object in the global namespace (i.e. window).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADOHBMFM6OC6N7EBWDR423TV6E7ZANCNFSM47YRJIZQ>
.
|
It seems like the key issue is using the I made a minimal test repository that uses this plugin in the rollup config, which should make it trivial to reproduce the issue I'm seeing. Details in the readme there: |
@geoffreylitt I ended up encountering this same issue due to having a similar setup. Could you share how you configured rollup to import the cjs version instead? Or did you just grab the .common.js version from -- EDIT -- |
I'm sorry, it's been so long that I don't remember what I did. I ultimately
switched my extension to using esbuild and now this isn't an issue anymore.
I think that I may have grabbed the commonjs version from dist as you
describe, but not sure.
…On Sat, Mar 19, 2022 at 8:05 PM, Kyle Kamperschroer < ***@***.***> wrote:
@geoffreylitt <https://github.com/geoffreylitt> I ended up encountering
this same issue due to having a similar setup. Could you share how you
configured rollup to import the cjs version instead? Or did you just grab
the .common.js version from dist instead of installing the npm module?
Thanks :)
—
Reply to this email directly, view it on GitHub
<#10 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHEBAARY5QVHBXL26YAK2TVAZTTDANCNFSM47YRJIZQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm using
ExtPay
in a project that uses the rollup bundler. I got this error when running the bundler:It appears that none of those four symbols are exported by the 'webextension-polyfill' module.
For the moment I was able to work around the issue by importing the commonjs version, which worked great.
I'm not sure if this is just some specific problem with my setup, or might be a broader issue with the module version of the package. It seems like
webextension-polyfill
might have an unusual module export format? From the readme:The text was updated successfully, but these errors were encountered: