angular-electron icon indicating copy to clipboard operation
angular-electron copied to clipboard

Deprecate url.format from main.ts

Open hassang11 opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. node url format is deprecated i think we should transition to something else - As of now it causes issue when building a nsis electron app .

I get a blank screen

Describe the solution you'd like I would recommend something similar to https://stackoverflow.com/questions/70327411/node-url-format-is-deprecated-what-should-we-use-instead

I am not sure if there compatibility issues - But had to modify the code for a temporary workaround

` } else { // Path when running electron executable let pathIndex = './index.html';

    if (fs.existsSync(path.join(__dirname, '../dist/index.html'))) {
        // Path when running electron in local folder
        pathIndex = '../dist/index.html';
    }

    let urlToLoad = url.format({
        pathname: path.join(__dirname, pathIndex),
        protocol: 'file:',
        slashes: true,
    });

    logEverywhere(urlToLoad);

    urlToLoad = urlToLoad.replace('///', '//');
    logEverywhere(urlToLoad);

    // urlToLoad = urlToLoad.replace('app.asar', 'app');

    // logEverywhere(urlToLoad);
    win.loadURL(urlToLoad);

`

Also for some reason i get an error when i set asar false in electron builder - Self is not defined

hassang11 avatar Jul 28 '22 01:07 hassang11