首页  >  问答  >  正文

创建适合桌面和 Web 部署的多功能 Vue+Electron 应用程序

我已经使用这个模板来开发我的应用程序,它是一个带有 Electron 构建器的 Vue 应用程序。现在我有一个问题: 我需要构建生产并部署我的项目一次作为电子包,另一次部署为托管在 Web 服务器上的 Web 应用程序。我也不想将它分成两个存储库。有人有什么建议吗?

我尝试使用 dist 文件夹作为网站的根文件夹,并添加了一个 web.config 文件,如下所示,但出现错误。

web.config文件内容:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Vue" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_URI}" pattern="^/api/.*" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

IIS 上的错误:

P粉418214279P粉418214279203 天前419

全部回复(1)我来回复

  • P粉068510991

    P粉0685109912024-03-30 14:34:24

    是的,您需要在 IIS 上安装 url 重写模块。否则,IIS 将无法理解 <rewrite> <rules> <rule name="Vue" stopProcessing="true"> 在 web.config 中的含义。

    此处下载

    回复
    0
  • 取消回复