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

Allow using pear with an arbitrary index.html #234

Open
knownasilya opened this issue Jul 24, 2024 · 10 comments
Open

Allow using pear with an arbitrary index.html #234

knownasilya opened this issue Jul 24, 2024 · 10 comments

Comments

@knownasilya
Copy link

knownasilya commented Jul 24, 2024

I wanted to get pear running with Ember.JS, which deposits its built index.html inside of dist/index.html. I wasn't able to get it to work due to path issues since pear assumed dist was part of the path or something like that.

@mafintosh
Copy link
Contributor

do you mean change the root of the requests? it just mounts the folder you stage as /, simple as that. If you wanna change the entrypoint just update the main field in package.json

@knownasilya
Copy link
Author

knownasilya commented Jul 24, 2024

Here's a reproduction: https://github.com/knownasilya/pear-rss

Run npm run build and npm run dev. Note I see this in pear devtools after a cmd+r:

Screenshot 2024-07-24 at 10 16 00 AM

@davidmarkclements
Copy link
Contributor

@knownasilya change you dev script to pear run -d dist

explained: pear dev is pear run -d . pear run <entypoint> within a pear project runs from that entrypoint, pear run dist should run dist/index.html if dist has also has a package.json (with main field omitted or set to index.html) pear run -d dist should do in dev mode. pear dev is soon to be deprecated for pear run - probably in the release after this coming one

@knownasilya
Copy link
Author

knownasilya commented Aug 6, 2024

Similar response
Screenshot 2024-08-06 at 12 13 43 AM

My guess is because /dist is in the path (if you notice in the devtools title bar) and this prevents items in dist/ from being served at /.

@davidmarkclements

I confirmed the above, by changing the paths manually (I could fix this from the Ember side). An additional issue is that the index is served as /dist/index.html and not as /dist/, which I don't think I can fix from the Ember side (this messes with the routing).

If the index could be served at / that would solve all the things though.

@davidmarkclements
Copy link
Contributor

@knownasilya if dist doesn't have a package.json then it's pear run dist/index.html - re the internal server error, run pear sidecar and then open your app with pear run, you may be able to see an error stack

@knownasilya
Copy link
Author

knownasilya commented Aug 6, 2024

Seeing this in sidecar
Screenshot 2024-08-06 at 9 25 47 AM

(assuming it errors for one thing and then stops there)

The devtools still looks the same as above.

@davidmarkclements
Copy link
Contributor

does the dist folder contain ember-cli-live-reload.js? if not that's the issue - ember might be doing something weird with paths? dist folder needs to be fully self contained, not sure why it would load dev tooling like that anyway?

@knownasilya
Copy link
Author

That one was actually not there (another issue, but not related to this). Deleting that gives me: Unknown Server Error Error: Not Found: "/assets/prss.css"

I updated the repo above with the dist dir: https://github.com/knownasilya/pear-rss so you can see what is there

@davidmarkclements
Copy link
Contributor

@knownasilya can you try with latest Pear v0.4444.pqbzjhqyonxprx8hghxexnmctw75mr91ewqw5dxe1zmntfyaddqy - if still no dice then write down the exact commands to run to reproduce, from cloning the repo etc on and I'll take a look at debugging it

@d61b292b-2859-4ed6-8c7c-b7397ad8e351

I ran into a similar issue. My main entry point in package.json is /dist/index.html

This works fine in dev mode. But when staging/releasing/seeding it seems to ignore that path and appears to use ./index.html

What worked was copying the contents of the dist folder and the package.json into a new folder

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