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
"crypto" is undefined for extensions #3338
Comments
Did you require crypto from node at the top of the file?
|
@rijkvanzanten You are right, with my example the problem is fixed. I put some more effort into debugging my scenario. I figured out that I have a problem with rollup and my bundled hook. This works:
But the same example (using "import" & typescript) does not work anymore after I but my hooks through rollup bundler. This is my rollup config:
Do I need to reconfigure my rollup set-up? |
There's no need to bundle your hooks if it's running under Node |
That's a bummer. I was setting something up so I could bundle extensions externally. |
I mean, you could. I'm assuming that you're rollup config is bundling things even though it shouldn't, or your TypeScript example exports it wrong. Keep in mind that TS
is generated to
which is not the correct format |
@rijkvanzanten For me, the export default works fine (maybe this depends on the tsconfig?). I think my problem actually has it's origin on how the package "uuid" is built, because my config works fine when I use For example
|
Here we go: uuidjs/uuid#544 Turns out this barely documented |
I've got a hook that makes use of the npm package "uuid". This package under the hood makes use of the crypto API (supported by modern browsers).
This crypto API is not available inside the directus hooks. Here's a simple example that will break directus:
Seeing the crypto API not being available, I wonder what else might not work inside the hooks.
The text was updated successfully, but these errors were encountered: