Developing for Windows

Compared to the other platforms, developing for Windows is a little trickier for the following reasons:

  • The Windows builds use mshtml, which is essentially IE11 (NOTE: We are moving to WebView2 for Wails V2 which will eliminate almost all of the issues discussed on this page)
  • Mshtml does not have a developer console which can make debugging Javascript fairly difficult (However we now have the option to inject firebug lite into your application)

IE11 Compatibility

The best way to ensure your app will work correctly when building is to test using the wails serve command and using IE11 to test your app. IE11 is quite behind in many respects so extra attention has to be paid to ensure your code works correctly, such as:

  • Adding polyfills for modern Javascript constructs.
  • Using alternatives for modern HTML APIs

Note: mshtml might be close to IE11, but it is not an exact similar environment, some features and browser capabilities might be unavailable in your wails powered app, such as localStorage.

During development, remember to make sure that npm run start creates an IE11 compatible build to be able to use it and preview your app, you can do that by adding this to your frontend/package.json:

"browserslist": {
    "production": [
        ">0.2%",
        "not dead",
        "not op_mini all",
        "ie 11"  
    ],
    "development": [
        "last 1 chrome version",
        "last 1 firefox version",
        "last 1 safari version",
        "ie 11"
    ]
}

Javascript polyfills

This is a collection of recommended polyfill packages you can use

Package Website
core-js Documentation (npm)
react-app-polyfill Documentation (npm)

HTML API Alternatives

This is a collection of IE11 compatible libraries

Incompatible Construct Alternatives
<input type="data"> JQuery Datepicker

Troubleshooting

My app is starting but I’m just getting a blank screen

Most likely, your application is using a non-IE11 compatible HTML or Javascript construct. Other causes can be the use of “browser APIs” that are not available in the mshtml webview, such as localstorage. Try running wails serve and opening up the application in IE11. Check the dev console for more details.

My app has no dev console - I’m flying blind!

As of wails v1.8.1-pre7, there is is a build flag that will inject firebug lite into your app. Build using wails build -d -firebug to enable this feature.

My app is using custom HTML and I’m getting a script error!

On Windows, you cannot reference external scripts in your HTML, EG: <script src="main.js"></script>.

My app works with wails serve but not wails build. Why?

Most likely, your application is using a non-IE11 compatible HTML or Javascript construct. Other causes can be the use of “browser APIs” that are not available in the mshtml webview, such as localstorage.

When running the <project>.exe a script error window pops up. Why?

This is similar to the previous issue, make sure to run wails serve with devtools open to check that your app renders correctly. If the app renders in IE11 and does not after building, it is possible that you are using a browser feature that exists in IE11 and not in mshtml (ie. localstorage)