Comments (7)
-
is this with the latest ImmortalDB v1.1.0?
-
please provide minimal code to reproduce the error so i can see exactly what you see
these window
checks may not suffice https://github.com/gruns/ImmortalDB/blob/master/src/index.js#L23, but i cant tell without an example where i can attempt to reproduce your error(s)
alternatively, can you test and open a pull request that fixes this? ideally the fix is simple, like the above WINDOW_IS_DEFINED
variable
thank you! 🙌
from immortaldb.
Hey!
Yes, is the latest version.
basicaly, to reproduce the error, you should create a nextjs project and install ImmortalDB, after this, when you import ImmortalDB, the error comes up.
I'll try to solve this and make a pull request, thanks!
from immortaldb.
The same in my project, when I've installed the immortal-db
package and put import { ImmortalDB } from "immortal-db"
somewhere in the source code (even the import is not in use), then mocha tests running in nodejs are failing on this error.
from immortaldb.
mocha tests running in nodejs are failing on this error.
It is failing on this line:
https://github.com/gruns/ImmortalDB/blob/master/dist/immortal-db.js#L10
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:
https://webpack.js.org/concepts/targets/#multiple-targets
from immortaldb.
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
from immortaldb.
how/why is immortaldb being imported and used in node?
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.
from immortaldb.
The reason in my case is unit testing in mocha, which is 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:
- cookies
- indexeddb
- localstorage
so while a version of immortaldb can certainly be built for node -- one that doesn't use the global window
variable, immortaldb wouldnt actually do anything as none of the storage engines exist in node without polyfills
this would, in turn, render all immortaldb usage no-ops in node
from immortaldb.
Related Issues (20)
- how to handle expired mechanism HOT 7
- SSR compatible HOT 6
- Option to remove all cookies set with ImmortalDB HOT 5
- I wouldn't recommend using SessionStorage HOT 3
- Ideas for additional persistent storage HOT 3
- Support for KV Storage HOT 2
- Reset database HOT 4
- Undefined should not be counted as value? HOT 2
- We don't use NPM or any module manager, so am getting "Cannot use import statement outside a module".... HOT 3
- Events HOT 6
- Add testing how-to snippet to the readme
- Set the SameSite attribute of saved cookies HOT 1
- Indexed DB HOT 1
- Differentiate a user-stored `'undefined'` from a deleted key with a sentinel value
- Use JSDoc HOT 3
- Synchronous get / set? HOT 1
- Size limit HOT 1
- You are only allowing strings and return undefined for JSON
- Implement a way to iterate the store keys
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from immortaldb.