【发布时间】:2021-08-20 05:43:57
【问题描述】:
我正在使用 Quasar 制作一个 Vue SPA 网络应用程序/页面。在这种情况下,该 Web 应用程序只能通过单击由 Quasar 打包程序创建的 index.html 文件来运行。该软件包将仅在本地分发,不会托管在域中。
现在我的问题是。由于我将使用XMLHttpRequest 打开包中的本地文件(xml 文件),因此我需要打开一个 Web 服务器。
有什么方法可以通过双击index.html(file:// 协议)自动启动(以编程方式)Web 服务器?
我在想这样的事情(但由于错误Cannot statically analyse 'require(…, …)' in line 74,我仍然无法让它工作):
const LocalWebServer = require('local-web-server')
const ws = LocalWebServer.create({
port: 9000,
directory: 'public'
})
/* shut down */
ws.server.close()
https://github.com/lwsjs/local-web-server/wiki/API-reference
谢谢!
【问题讨论】:
标签: javascript html node.js vue.js quasar-framework