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

static files are not loading in development environment #58

Open
jay51 opened this issue Apr 27, 2019 · 1 comment
Open

static files are not loading in development environment #58

jay51 opened this issue Apr 27, 2019 · 1 comment

Comments

@jay51
Copy link

jay51 commented Apr 27, 2019

In my renderer I'm trying to load an audio file placed in static/audio/sound.mp3, but it gives me file 404 not found.

const mp3  = path.join(__static, "/audio/sound.mp3");
const audio = new Audio(mp3);
audio.play();

following the docs i used the __static variable but it's still not working.
I also tried with images and it still not working.

@jay51
Copy link
Author

jay51 commented Apr 27, 2019

the problem was that, when linking to static files don't use relative paths or absolute paths.
just server from the current dir.

const mp3  = "audio/sound.mp3"
const audio = new Audio(mp3);
audio.play();

I think this should be mentioned in the docs

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

1 participant