novu
novu copied to clipboard
🐛 Bug Report: notification center attempts to include child_process, fs, etc.
📜 Description
Module "child_process" has been externalized for browser compatibility. Cannot access "child_process.spawn" in client code.
This appears to be due to the reliance on axios
which does not support esm (or at least known issues with vite).
Ref: https://github.com/vitejs/vite/issues/174, https://github.com/vitejs/vite/issues/184, etc.
Please consider using fetch instead.
👟 Reproduction steps
- Use vite (ts react)
-
import { NovuProvider } from "@novu/notification-center";
- There ya go
👍 Expected behavior
Probably want it to work with vite.
👎 Actual Behavior with Screenshots
Crashes entire app.
💻 Operating system
Linux
🤖 Node Version
16
📃 Provide any additional context for the Bug.
Technically running via Tauri, but I don't think relevant to the bug
👀 Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- [X] I have read the Contributing Guidelines
Hey there, I'd like to work on this issue. Can you assign it to me please?
@AlexVCS , I've assigned you 🚀 , let me know if you need any help
@AlexVCS did you had a time to look at this? LEt me know if I should un-assign you perhaps someone else will be able to take a look at this 🙏♥️
Hey @scopsy sorry for the delay! I'd still like to try and work on this, thanks
I tried recreating this issue. I made a Vite TS React project, installed and included import { NovuProvider } from "@novu/notification-center";
The app seems to run just fine with no crashing or errors. @qw-in are you still having this issue?
I am on a Mac and not Linux, for the record.
@AlexVCS maybe it's only a warning and not an actual error? Perhaps during build time or in the console of the web project?
Good point @scopsy. From what I've looked at so far it seems like the error occurs during build time.
I tried recreating this issue. I made a Vite TS React project, installed and included
import { NovuProvider } from "@novu/notification-center";
The app seems to run just fine with no crashing or errors. @qw-in are you still having this issue?
Unfortunately I am no longer working on the project I was at the time. If no one else can reproduce I'd say probably safe to conclude this issue is fixed. Thanks!
It seems that this error keeps happening, but in my tests it only occurred when I put NovuProvider tag. In my case, the error appeared in the console and not in build time!
I tried recreating this issue. I made a Vite TS React project, installed and included
import { NovuProvider } from "@novu/notification-center";
The app seems to run just fine with no crashing or errors. @qw-in are you still having this issue?
Same here.
@Plactom could you please state the version of Vite you used. Also it would be helpful to also share your package.json and vite.config.ts along with any additional snippets or info you think might be relevant.
@scopsy based on this comment by one of the Vite maintainers, do you think it's worth it to just go ahead and migrate from using Axios
to fetch
?
Update:
We could also retain axios
but then use snowpack to convert.
@gitstart-novu would be great if we can use axios for now and just fix the warning.
Hi @scopsy still unable to reproduce the issue. Note that it was tried on different versions of Vite
starting from 2.x.
@scopsy Having not been able to reproduce the issue, do you think it's safe to close this issue as fixed?
Yes we can close this, can be reopened again if needed 🙏