Git Product home page Git Product logo

Comments (7)

sindresorhus avatar sindresorhus commented on May 18, 2024 1

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

from electron-serve.

burtonator avatar burtonator commented on May 18, 2024

these were questions not statements ;)

from electron-serve.

sindresorhus avatar sindresorhus commented on May 18, 2024

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.

from electron-serve.

customautosys avatar customautosys commented on May 18, 2024

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.

from electron-serve.

ibash avatar ibash commented on May 18, 2024

@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') {

from electron-serve.

customautosys avatar customautosys commented on May 18, 2024

@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?

from electron-serve.

ibash avatar ibash commented on May 18, 2024

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.

from electron-serve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.