How to use realm on an electron app?
See original GitHub issueERROR in ./~/realm/lib/browser/index.js
Module not found: Error: Can't resolve 'react-native' in
'/Users/H/Documents/MyApp/node_modules/realm/lib/browser'
@ ./~/realm/lib/browser/index.js 21:0-45
@ ./~/realm/lib/index.js
@ ./render/routes/tools/Network.js
@ ./render/router.js
@ ./render/index.js
@ multi (webpack)-dev-server/client?http://localhost:9527 webpack/hot/dev-server react-hot-loader/patch webpack-dev-server/client?http://localhost:9527/ webpack/hot/only-dev-server ./render/index.js
Not rewriting GET /dist/bundle.js because the path includes a dot (.) character.
I want to use realm
on an electron
app with Node 6, and I used the code below but it doesn’t work and the error imformation is above.
const Realm = require('realm')
let realm = new Realm({
schema: [
{
name: 'LogItem',
properties: {
time: 'date',
percent: 'double'
}
}
]
})
realm.write(() => {
realm.create('Log', {
time: new Date(),
percent: 90.00
})
})
Issue Analytics
- State:
- Created 6 years ago
- Comments:28 (10 by maintainers)
Top Results From Across the Web
Quick Start with Electron — Realm
Quick Start with Electron · Overview · Setup · Set up Your Application Files · Create the Main Script File · Set up...
Read more >Using Realm from npm on Electron JS app
The usual workaround is to use the electron-builder package and run its install-app-deps command, which will install the appropriate ...
Read more >Installing Realm with Electron-Webpack | by Max Alexander
If you need a fast native database for your electron app then don't look any further than Realm! It's blazing fast and works...
Read more >realm - npm
Start using realm in your project by running `npm i realm`. ... (both iOS & Android), Node.js and Electron (on Windows, MacOS and...
Read more >Learn Electron, Mongodb and Realm
electron · realm ... First API with Node.js, Express and MongoDB. John Lindquist ... Find and Manipulate Data using Aggregation in MongoDB. Kamran...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kneth Thanks again for your prompt response.
As it turns out - my attempt to use create-react-app with electron and realm was a fools errand. The build process for CRA is not compatible with the use of native node modules without ejecting and futzing around with millions of things.
For anyone else wishing to use electron/react/typescript/realm - the simplest way to get started is to use electron-forge and the react/typescript template, then add the realm npm package / import realm. Couldn’t be simpler really.
npm install -g electron-forge
electron-forge init my-new-project --template=react-typescript
cd my-new-project
npm install realm
Hope this helps someone 😃
B
What a hell? Still no solution for this?! =(