Skip to content

Question: How did you avoid typescript errors not finding node modules? #96

Open
@da-mkay

Description

@da-mkay

Hi there, nice project! I'm trying to figure out how some things work in your project for better understanding 😄 I hope it's okay to post a question here 👼 .

When importing a node-module in your AppComponent, for example using the following line, it just works:
import * as fs from 'fs';

However, if I try to set up an Angular project manually that I can later open in electron, I am not able to compile, because I get the following error:
error TS2307: Cannot find module 'fs'.
What I did:
I created a simple new Angular 7 app + added a custom webpack config (listing 'fs' as external as in your webpack config) + updated angular.json to use that config (using @angular-builders/custom-webpack:browser and customWebpackConfig-option, exactly as you did). Then run ng build.
NOTE: @types/node and @angular-devkit/build-angular are installed and my editor (VSCode) is not showing any error.

Am I missing something? How do I get the ts-code compiled?

Best regards

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions