You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Sounds like tsconfig.json issue. Did you override typeRoots by any chance? Maybe Angular build is picking the wrong config?
If you have provided a repository with reproduction I would have had more chances to help you out.
Nope, I didn't touch the tsconfig, just using Angular's defaults. I set up a project here. There are just 2 commits. The first one is the output of ng new and the second adds the custom_webpack builder and a custom webpack config declaring fs module as external. Running ng build shows the error that fs is not found. I can fix this by setting "types": ["node"] intsconfig.app.json, but that doesn't seem to be right and in your project it's also not set.
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
The text was updated successfully, but these errors were encountered: