You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

14 lines
464 B

/* eslint import/prefer-default-export: off */
const { URL } = require('url');
const { path } = require('path');
function resolveHtmlPath(htmlFileName) {
if (process.env.NODE_ENV === 'development') {
const port = process.env.PORT || 3000;
const url = new URL(`http://localhost:${port}`);
url.pathname = htmlFileName;
return url.href;
}
return `file://${path.resolve(__dirname, './build', htmlFileName)}`;
}
module.exports = resolveHtmlPath