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
Describe the bug
Using (allowed)electron packages in renderer project throws compilation errors
To Reproduce
If I import something in my angular project like:
import { shell } from 'electron';
or
import { nativeImage } from 'electron';
it throws:
./node_modules/electron/index.js:1:9-22 - Error: Module not found: Error: Can't resolve 'fs' in '/Users/nikhilverma/Downloads/stringish-migrated/node_modules/electron'
./node_modules/electron/index.js:3:11-26 - Error: Module not found: Error: Can't resolve 'path' in '/Users/nikhilverma/Downloads/stringish-migrated/node_modules/electron'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
Steps to reproduce the behavior:
Hopefully this should be easy:
Just download the current version of this template
In detail.component.ts, at the very top write: import { nativeImage } from 'electron';
In the same file, inside ngOnInit() write: const n = nativeImage.createEmpty();
Expected behavior
A clean compilation build in the console
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
MacOS 11.4
Add any other context about the problem here.
I am trying to migrate to the latest version of this electron(13.1.7). So far I have successfully converted my entire codebase to angular. But somehow making it work with electron 13 is a huge configuration challenge. Also I am moving from the old one package.json file configuration which had everything under devDependencies.
But the above bug is easily reproducible outside my project environment in the default template project itself.
Thanks.
The text was updated successfully, but these errors were encountered:
I took cues from electron.service.ts and changed my import declarations
Instead of saying: import { nativeImage } from 'electron';
I use this syntax: import { nativeImage as nativeImageType } from 'electron'; const nativeImage:typeof nativeImageType = window.require('electron').nativeImage;
My old codebase worked pleasantly with the first syntax but now I am coerced to use this one instead.Also it took me three days to figure out this bug and these kinds of traps are very annoying during migration.
Describe the bug
Using (allowed)electron packages in renderer project throws compilation errors
To Reproduce
If I import something in my angular project like:
import { shell } from 'electron';
or
import { nativeImage } from 'electron';
it throws:
./node_modules/electron/index.js:1:9-22 - Error: Module not found: Error: Can't resolve 'fs' in '/Users/nikhilverma/Downloads/stringish-migrated/node_modules/electron'
./node_modules/electron/index.js:3:11-26 - Error: Module not found: Error: Can't resolve 'path' in '/Users/nikhilverma/Downloads/stringish-migrated/node_modules/electron'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
Steps to reproduce the behavior:
Hopefully this should be easy:
Expected behavior
A clean compilation build in the console
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
MacOS 11.4
Add any other context about the problem here.
I am trying to migrate to the latest version of this electron(13.1.7). So far I have successfully converted my entire codebase to angular. But somehow making it work with electron 13 is a huge configuration challenge. Also I am moving from the old one package.json file configuration which had everything under devDependencies.
But the above bug is easily reproducible outside my project environment in the default template project itself.
Thanks.
The text was updated successfully, but these errors were encountered: