Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

looks like it doesn't handle asar files? #6

Closed
burtonator opened this issue Sep 23, 2018 · 7 comments
Closed

looks like it doesn't handle asar files? #6

burtonator opened this issue Sep 23, 2018 · 7 comments

Comments

@burtonator
Copy link

Just local directories? This means packaged apps won't work though...

@sindresorhus
Copy link
Owner

Have you actually tried it or are you just assuming? I'm using this module in multiple production apps with ASAR.

@burtonator
Copy link
Author

these were questions not statements ;)

@sindresorhus
Copy link
Owner

All the Node.js fs methods are patched for ASAR in Electron and works like normal. So there's nothing special needed to support ASAR.

@customautosys
Copy link

I am facing the same problem. When my app is built using electron builder, I get a File Not Found error unless I set asar:false. It appears that when ASAR is built, app.getAppPath is returning an empty string for some strange reason.

@ibash
Copy link
Contributor

ibash commented Nov 5, 2020

@siauderman late to the game, what are you setting the directory to?

If you're setting it to the top level like: serve({ directory: '.' })

There's a bug where no path is doesn't serve index.html for app://-

// filePath = "...Contents/Resources/app.asar"
// so path.extname(filePath) === ".asar" and it serves file not found

if (resolvedPath || !path.extname(filePath) || path.extname(filePath) === '.html') {

@customautosys
Copy link

@siauderman late to the game, what are you setting the directory to?

If you're setting it to the top level like: serve({ directory: '.' })

There's a bug where no path is doesn't serve index.html for app://-

// filePath = "...Contents/Resources/app.asar"
// so path.extname(filePath) === ".asar" and it serves file not found

if (resolvedPath || !path.extname(filePath) || path.extname(filePath) === '.html') {

so instead of serve({ directory: '.' }), what should I be doing?

@ibash
Copy link
Contributor

ibash commented Nov 7, 2020

Oh, I think directory: '.' should work, made a PR that fixes it: #26

You could point your package.json to ibash/electron-serve in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants