首頁  >  問答  >  主體

建立適合桌面和 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 天前417

全部回覆(1)我來回復

  • P粉068510991

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

    是的,您需要在 IIS 上安裝 url 重寫模組。否則,IIS 將無法理解 <rewrite> <rules> <rule name="Vue" stopProcessing="true"> 在 web.config 中的意義。

    此處下載

    #

    回覆
    0
  • 取消回覆