-
Notifications
You must be signed in to change notification settings - Fork 62
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
Nextjs window is not defined error #63
Comments
these alternatively, can you test and open a pull request that fixes this? ideally the fix is simple, like the above thank you! 🙌 |
Hey! I'll try to solve this and make a pull request, thanks! |
The same in my project, when I've installed the |
It is failing on this line: Obviously, the bundle was not bundled for node target. Is it possible to distribute bundle for node target too? Maybe via multiple targets defined in webpack config, see: |
ya. we'll likely have to build two targets, a la but @Felipe-martins1 and @martinschayna as we walk down this path together, help me understand: how/why is immortaldb being imported and used in node? for example, as part of the build process? or do you actually run immortaldb in node with browser shims? perhaps there's another solution here before we build two targets: one for node and one for the browser |
The reason in my case is unit testing in mocha, which is running in node. Some low level parts of my web application uses immortal-db for caching, mainly for outstandingly simple interface and very usable configuration. These parts are used from the web app, so I want to test them carefully. Other people may use immortal-db on server side, which is also running in node. |
makes sense. thank you for sharing! from my limited knowledge of webpack, and going off of it looks like two different build versions would be necessary that said, zooming out, building for node really doesnt make much sense as all the storage engines that immortaldb uses don't exist in node, ie:
so while a version of immortaldb can certainly be built for node -- one that doesn't use the global this would, in turn, render all immortaldb usage no-ops in node |
Hi!
i'm recently working on the nextjs project and i started using immortalDB, but i'm getting the error "window not defined", even before using any of the functions (get, set, delete), when i import immortalDB the error starts to show up, how can i fix this? thanks!
Good job, ImmortalDB is awesome!😄
The text was updated successfully, but these errors were encountered: