'Electron & Lit rollup build

Im trying to create a electron app using Lit based on the Open Wc recommendations (https://open-wc.org/guides. I build the app using rollup and the build runs flawless on the es-dev-server but when I try to use my build in Electron this get weird (me not understanding how things work)... Someone that know what I am missing here?

File structure

Electron app with debug

index.html

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
  <meta name="Description" content="Put your description here.">
  <base href="/">

  <style>
    html,
    body {
      margin: 0;
      padding: 0;
      font-family: sans-serif;
      background-color: #ededed;
    }
  </style>
  <title>hmgo-gate-app</title>
</head>

<body>
  <hmgo-gate-app></hmgo-gate-app>

  <script type="module" src="./src/hmgo-gate-app.js"></script>
</body>

</html>

hmgo-gate-app.js

import { LitElement, html, css } from 'lit';

export class HmgoGateApp extends LitElement {
  static get properties() {
    return {
      title: { type: String },
    };
  }

  static get styles() {
    return css`
      :host {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        font-size: calc(10px + 2vmin);
        color: #1a2b42;
        max-width: 960px;
        margin: 0 auto;
        text-align: center;
        background-color: var(--hmgo-gate-app-background-color);
      }

      main {
        flex-grow: 1;
      }

    `;
  }

  constructor() {
    super();
    this.title = 'H&M GO Gate App';
  }

  render() {
    return html`
      <main>
        <h1>${this.title}</h1>

        <p>Edit <code>src/HmgoGateApp.js</code> and save to reload.</p>

      </main>

    `;
  }
}

customElements.define('hmgo-gate-app', HmgoGateApp);

electron/main.js

const { app, BrowserWindow } = require('electron')
const path = require("path")


const createWindow = () => {
  const win = new BrowserWindow({
    width: 800,
    height: 600
  })

  win.webContents.openDevTools()

  //win.loadFile(path.join(__dirname, '../dist/index.html'))

  win.loadURL(`file://${path.join(__dirname, '../dist/index.html')}`);
  
}

app.whenReady().then(() => {
  createWindow()

  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) createWindow()
  })
})

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit()
})


Sources

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

Source: Stack Overflow

Solution Source