Commit 53ea520c authored by rocosen's avatar rocosen

Update util.ts

parent a430b433
...@@ -6,9 +6,17 @@ export function resolveHtmlPath(htmlFileName: string) { ...@@ -6,9 +6,17 @@ export function resolveHtmlPath(htmlFileName: string) {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
const port = process.env.PORT || 1212; const port = process.env.PORT || 1212;
const url = new URL(`http://localhost:${port}`); const url = new URL(`http://localhost:${port}`);
url.pathname = htmlFileName; url.pathname = htmlFileName;1234
let goPath = url.href.replace('%23', '#') let goPath = url.href.replace('%23', '#')
return goPath; return goPath;
}else{
let opts = require('url').format({
protocol: 'file:',
slashes: true,
pathname: path.resolve(__dirname, '../renderer/'),
hash:htmlFileName
})
// return `file://${path.resolve(__dirname, '../renderer/', htmlFileName)}`;
return opts
} }
return `file://${path.resolve(__dirname, '../renderer/', htmlFileName)}`;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment