I'm going to make GUI scrapper with Electron & Nightmare. However when I use just plain html/js as described in Electron quickstart, all works well. But I'd like to make Electron app nicely by using Anugular2(angular-cli webpack). I created project ng new Scrapper
then made some routes for components e.g. HomeComponent
, SettingsComponent
. I installed nightmare in angular project folder by npm install --save nightmare
and I would like import it in SettingsComponent
like:
import {Nightmare} from 'nightmare';
and use it like:
ngOnInit{
this.nightmare = new Nightmare({
show: true,
electronPath: require('node_modules/electron')
})
}
What have I tryied:
1) in index.html including
<script src="node_modules/nightmare/lib/nightmare.js"></script>
2) then in my component
declare var Nightmare: any;
3) ngOnInit(){
this.nightmare = new Nightmare({})
4) Gettings errors about missing other js files inside node_modules/nightmare/lib/*.js
It is possible to interact with Angular2/Nightmare inside Electron App?
via Evgheny Kalkutin
No comments:
Post a Comment