'Is there a way to modify a value in a JavaScript file with wix?

In installer we let the user insert the server address for the website. With an XmlFile it is not a problem. Here I use util:XmlFile

  <Component Id="Web.config" Guid="*" Directory="INSTALLFOLDER" Permanent="yes">
    <File Id="WebConfigFile" Name="Web.config" Source="..\Web\Web.config" KeyPath="yes" />
    <util:XmlFile
          Id="ServerAddress"
          Action="setValue"
          Permanent="yes"
          File="[INSTALLFOLDER]Web.config"
          SelectionLanguage="XPath"
          ElementPath="//configuration/appSettings/add[\[]@key='remotelocation'[\]]"
          Name="value"
          Value="[SERVER]"
          Sequence="1"/>
  </Component>

But at the current Website we store the server address in an env.js file.

Is it possible to change a js file with the same way as with the xml file?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source