Как я могу обновить приложение Electron, которое использует lit-element, до Electron v7.0.0? - PullRequest
0 голосов
/ 01 ноября 2019

Запуск моего приложения в Electron v5.0.11 работает нормально, но когда я пытаюсь выполнить обновление до любой более новой версии (например, Electron v7.0.0), мой веб-компонент с освещенными элементами не отображается, и я получаю эту ошибку в консоли chromium:

Error: Cannot find module './dist/renderer.js'

Снимок экрана: https://imgur.com/a/ovhTIvH

Мое приложение использует esm в index.html для переноса модулей узлов с освещенными элементами,Это, кажется, где приложение ломается.

nodeIntegration также установлен на true в моем файле main.ts.

index.html


    <body>
        <app-component></app-component>
        <script>
            require = require("esm")(module);
            module.exports = require("./dist/renderer.js");
        </script>
    </body>

renderer.ts


    import "./components/app-component";

app-component.ts


    import { customElement, html, LitElement } from "lit-element";

    @customElement("app-component")
    export class AppComponent extends LitElement {
        render() {
            return html`
                <div id="app-container">
                    <h1>Test</h1>
                </div>
            `;
        }
    }

package.json


    "devDependencies": {
        "electron": "7.0.0", <b>* App works fine when this value is "5.0.11" *</b>
        "esm": "^3.2.25",
        "lit-element": "^2.2.1",
        "tslint": "^5.20.0",
        "typescript": "^3.6.4"
    }

tsconfig.json


    {
        "compilerOptions": {
            "module": "commonjs",
            "target": "es2015",
            "noImplicitAny": true,
            "sourceMap": true,
            "outDir": "dist",
            "baseUrl": ".",
            "moduleResolution": "node",
            "experimentalDecorators": true
        },
        "include": ["src/**/*"]
    }

...