image cannot be resolved when application is packed
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 641
- Avg merge
- 3d 17m
- Merged PRs (30d)
- 32
Description
### Pre-flight checklist
- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
### Electron Forge version
6.1.1
### Electron version
24.0.0
### Operating system
Ubuntu 22.04
### Last known working Electron Forge version
_No response_
### Expected behavior
When using electron forge webpack typescript template. The image should be packed and resolved when npm run package or npm run make
### Actual behavior
I got this code for tray icon:
```typescript
// some code
const icon = nativeImage.createFromPath(
path.resolve("./src/assets/xnauta.png")
);
const tray = new Tray(icon);
// some more code
console.log("testing the path ", path.resolve("./src/assets/xnauta.png"));
```
if I run npm start , the tray icon is rendered correctly. icon path path is resolved to :
/home/yosle/projects/xnauta-electron/src/assets/xnauta.png
When executing after npm run package or pn run make, tray icon is not rendered , and icon path is resolved to :
/home/yosle/projects/xnauta-electron/out/xnauta-linux-x64/resources/app/.webpack/main/assets/xnauta.png
If I navigate to this folder , the file doesn't exist.
Also tried this on Windows with similar result, tray icon is not shown, but tray menu options are displayed

### Steps to reproduce
run app with npm start, Tray icon is rendered correctly:

run npm run package and execute the binary or run npm run make , install the deb package and execute the app:

### Additional information
if I run npm start , the tray icon is rendered correctly. icon path path is resolved to :
/home/yosle/projects/xnauta-electron/src/assets/xnauta.png
When executing after npm run package, tray icon is not rendered , and icon path is resolved to :
/home/yosle/projects/xnauta-electron/out/xnauta-linux-x64/resources/app/.webpack/main/assets/xnauta.png
If I navigate to this folder , the file doesn't exist.
Contributor guide
Assessment
This issue has not been assessed yet.