Comments (2)
Forgot to add that I had to remove references to bootstrap for now, as the electron-builder would throw errors (Error: Unresolved node modules: jquery, popper.js), for possible work arounds see electron-userland/electron-builder#2529
ON EDIT - just looking at my other changes:
- In typings.d.ts in root dir I had to add:
declare var window: Window;
interface Window {
process: any;
require: any;
}
So that I could do window.require('better-sqlite3');
Again this was found by looking at what https://github.com/maximegris/angular-electron did.
So using better-sqlite3 as an example, to use the native module would look like:
import * as Database from 'better-sqlite3';
// then instead of doing
// const db = new Database(args...);
// do
const dataBase: typeof Database = window.require('better-sqlite3');
const db = dataBase(args...);
The maximegris repo creates a service to hide the window.require("native-module") part.
To be honest I'm not sue why this works. From a 'coding' point of view I much prefer not having to do the window.require and just import then new the object, which is how it worked with the https://github.com/colinskow/angular-electron-dream-starter repo. It would be nice to figure out how the default paths used for require are produced.
Greg.
from electron-angular-ngrx.
@greg9504 Fantastic research and documentation. Ill take a look at this, this weekend. There are some things i want to try with extending the CLI for a more natural integration and should help with this.
from electron-angular-ngrx.
Related Issues (7)
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 electron-angular-ngrx.