Replies: 7 comments
-
Hey 👋 It seems like you're trying to bundle OpenPGP.js as part of a larger example.bundle.js file, right? This is not supported, for now. Please see if you can convince your build system to treat OpenPGP.js as an external dependency, and require openpgp.min.js at runtime, instead of at build time. |
Beta Was this translation helpful? Give feedback.
-
Thx for an answer @twiss !
Can you maybe clarify a bit how that is possible, namely when using Webpack for bundling? Would be very grateful! |
Beta Was this translation helpful? Give feedback.
-
Hi @ArtemisKS 👋 Something like https://webpack.js.org/configuration/externals/ should work, I think. For what it's worth, for the example above, you don't need a build system at all, and you can just run it as-is on Node.js, with OpenPGP.js in a separate file. But I do understand that for a larger example, this may not be the case. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for your answer, @twiss ! Unfortunately, it didn't work out, as we are trying to run OpenPGP on native mobile platforms (iOS & Android, swift & java respectively). Have been trying to use OpenPGP there with the help of LiquidCore, a virtual node env for mobile platforms. So far, it hasn't worked out, because of an aforementioned error, and errors like that (for iOS, it has been built, but throws exceptions when using OpenPGP methods, like readArmored). Besides, for iOS there's this native js virtual environment, JavaScriptCore, and I have thus far been unable to work with openpgp from there, although I did successfully so with other npm modules, such as thinbus-srp. Perhaps there's not much point in telling you all this, but maybe you can help us out with it, or else, give us your advice or manual on how to successfully run OpenPGP on mobile platforms. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
So - it seems to have this automatic bundling thing: https://github.com/LiquidPlayer/LiquidCore#automatic-bundling. Are you using that? If so, I'm guessing you may be caught up by that. Do you need bundling? I.e. do you have any dependencies other than OpenPGP.js that are cumbersome to copy to the output directory manually? If no, then the easiest may be to just not use bundling at all, and copy your scripts manually. Or, if you're already using your own bundling (using Webpack), you shouldn't need it either. If you still want their bundling, you might have to convince Metro (the bundler they're using) to exclude OpenPGP.js. There are some hints of how to do that here: https://stackoverflow.com/a/41963217 |
Beta Was this translation helpful? Give feedback.
-
You are right - OpenPGP.js is as part of a larger example.bundle.js file. Unfortunately I could not get openpgp.js outside of the bundle (as an external dependency) during apk building in Android Studio. And the file "metro.config.js" with "...blacklistRE: blacklist([/dist/.*/]" and other options didn't help me ... I'm not strong in JS ((( |
Beta Was this translation helpful? Give feedback.
-
OpenPGP.js has its own build system which is pretty complex, and for now, we only publish ready-made dist bundles. We would like to fix this, and make it possible to use an external build system, though: see #547, for example. |
Beta Was this translation helpful? Give feedback.
-
Hi guys,
I use LiquidCore (Node.js virtual machine) inside my Android App. And I'm trying to use openpgp.js under Node. Here is my file example.js
and here is result
Does anybody know why it happens? And how it can be fixed?
Thanks a lot
Beta Was this translation helpful? Give feedback.
All reactions