Closed xiezhengyun closed 1 year ago
Did you change any Electron Builder config?
By default every file in /src/main/static
is packaged in app.getAppPath() + '/static/...'
.
If not, unpack the app.asar
file in dist
. Do you see a static
directory there?
I change Electron Build config, But just add main/utils && nisi && publish
{
"appId": "pacsclient",
"directories": {
"output": "dist"
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true,
"shortcutName": "pacsclient",
"deleteAppDataOnUninstall": true,
"include": "scripts/urlProtoco.nsh"
},
"win": {
"target": "nsis"
},
"linux": {
"target": ["snap"]
},
"publish": [{
"provider": "generic",
"url": "http://127.0.0.1:9005/"
}],
"files": [
"build/main/**/*",
{
"from": "build/renderer",
"to": "renderer",
"filter": ["**/*"]
},
{
"from": "src/main/static",
"to": "static",
"filter": ["**/*"]
},
{
"from": "src/main/utils",
"to": "utils",
"filter": ["**/*"]
},
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!src",
"!config",
"!README.md",
"!scripts",
"!build/renderer",
"!dist"
]
}
This is the result of packaging
'main/static/appTray' is not in result
now i add 'renderer/public/trayIcon.png', This in 'build/renderer/trayIcon.png'
so:
this work
I want to make some suggestions
The static
directory is only copied to the build
directory when the dev-server.js
script is ran (npm run dev
). When the app is being packaged, the static
directory is directly copied over from src/main/static
.
In both production and development, static files are always available at app.getAppPath() + '/static/myFile.txt'
.
If you unpack the app.asar
file, the structure should look something like this:
I can't immediately tell what's causing the issue you're facing. Do you have a repo with minimal reproduction?
Thank you very much for your patience
This is my problem. I opened the app.asar
file as you said, and then changed the path. It's successful
But this seems to be the same as my previous writing
But now it's all right😂
reproduction
But now it's all right😂
Are you implying it's working as intended?
I packaged the app you sent me, the tray icon appears on both dev & packaged builds
Yes, no problem now
tray icon path
The path of the pallet cannot be found after packaging
in createWindow function
How should I fill in the path
Thank you.