【发布时间】:2022-07-29 21:34:41
【问题描述】:
我有一个非常特殊的问题,我有一个使用 Preact 构建的 Neutralino 应用程序,在使用 neu run 运行时运行良好,但是,一旦我构建项目(打开或关闭 enableServer),构建的应用程序将不加载任何东西。
打开enableServer,它会抱怨无法连接到本地主机:
"This localhost page cannot be found"
关闭它会给我一个全白的屏幕/DOM。
GitHub 存储库在这里:https://github.com/SpikeHD/XeniaLauncher
我怀疑这可能是我构建项目的方式,但我觉得 neu run 完全正常工作很奇怪。
下面是我的配置:
{
"applicationId": "js.xenia_launcher.app",
"version": "1.0.0",
"defaultMode": "window",
"port": 0,
"documentRoot": "/build/",
"url": "/",
"enableServer": true,
"enableNativeAPI": true,
"tokenSecurity": "one-time",
"logging": {
"enabled": true,
"writeToLogFile": true
},
"nativeAllowList": [
"app.*",
"os.*",
"filesystem.*",
"storage.*",
"window.*",
"debug.log"
],
"modes": {
"window": {
"title": "XeniaLauncher",
"width": 1000,
"height": 800,
"minWidth": 400,
"minHeight": 200,
"fullScreen": false,
"alwaysOnTop": false,
"icon": "/resources/icons/appIcon.png",
"enableInspector": true,
"borderless": false,
"maximize": false,
"hidden": false,
"resizable": true,
"exitProcessOnClose": true
},
"browser": {},
"cloud": {
"url": "/resources/#cloud",
"nativeAllowList": [
"app.*"
]
},
"chrome": {
"width": 1000,
"height": 800,
"args": "--user-agent=\"Neutralinojs chrome mode\""
}
},
"cli": {
"binaryName": "XeniaLauncher",
"resourcesPath": "/resources/",
"extensionsPath": "/extensions/",
"clientLibrary": "/resources/js/neutralino.js",
"binaryVersion": "4.4.0",
"clientVersion": "3.3.0"
}
}
【问题讨论】:
-
请注意:您的
package.json中缺少preact-cli和@neutralinojs/neu——如果不单独安装它们,任何人都无法克隆和运行您的应用程序。如果您已全局安装,则应在自述文件中添加注释(而且您确实不应该在全局安装preact-cli,我们建议您不要这样做)。
标签: javascript preact neutralinojs