posit-dev / posit-dev/py-shinylive

Expoted project doesn't load JS

Open
#51 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
56
Forks
6
Avg merge
3m
Merged PRs (30d)
1

Description

Project structure:

app.py
www/
└── main.js

app.py:

from pathlib import Path
from shiny.express import ui
ui.include_js(Path(__file__).parent / "www" / "main.js")

Problem description:

  • app works correctly when launched using shiny run app.py.
  • but, after running shinylive export . site, the JS file returns a 404 error when the app is accessed through the exported site.
  • i think the core issue is that shinylive export does not copy the www folder into the export directory automatically.
  • manual copying of the www folder after export does not resolve the 404 error.

how do i correctly include JS files to the app?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app.py and the www/main.js example, then reproduce the issue with shiny run app.py and shinylive export . site. Inspect how the export handles the www folder and how the exported site requests main.js; done means the exported site loads the JavaScript without a 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.