I'm building a simple project with Angular 6 and Electron 4. In my project I'd want to use fs from node but it results in an empty object when I try to output it. Here's my code:
import { Component } from '@angular/core';
import * as fs from 'fs';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
constructor() {
console.log(fs); // empty object
}
}
I've added "browser": {"fs": false}
as suggested in this issue, and I've installed @types/node
and added "types": ["./../node_modules/@types/node"]
in tsconfig.app.json
.
I googled a lot to find a solution but I can't get it to work. Any suggestions?