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

Broken elm-pages build --base - only changes outputs partially #404

Open
georgesboris opened this issue Aug 1, 2023 · 4 comments
Open

Comments

@georgesboris
Copy link
Contributor

I'm trying to build an elm-pages website that will be completely hosted inside a subpath of another site.

/blog/* -- elm-pages
/* -- something else

When using elm-pages dev --base=/blog everything seems to be working but when using elm-pages build --base=/blog I get this output:

/blog/index.html
/blog/post/index.html
/blog/category/index.html
api-patterns.json
all-paths.json
_redirects
elm.1234568.js
elm.js
elm.js.opt
route-patterns.json
style.css
template.html

This is problematic since some files are expected to be at the root of the website, not the specified path. However, I may be using elm-pages for another subpath (for any reason) or some other framework might want to use /style.css, etc. I would expect the --base option to change everything like this:

/blog/
  index.html
  post/index.html
  category/index.html
  api-patterns.json
  all-paths.json
  _redirects
  elm.1234568.js
  elm.js
  elm.js.opt
  route-patterns.json
  style.css
  template.html

Important this is not only problematic for conflict purposes but it is in fact broken since some of the links are expected to be at /paper/* even though they are still created at the root (e.g. elm.12345678.js, style.css, etc)

@georgesboris georgesboris changed the title elm-pages build --base only changes outputs partially Broken elm-pages build --base - only changes outputs partially Aug 1, 2023
@georgesboris
Copy link
Contributor Author

SSCCE here: https://github.com/georgesboris/elm-pages-basepath-sscce/tree/main

Created with:

npx elm-pages init elm-pages-basepath
cd elm-pages-basepath
npm i -D http-server
npm i

Copy scripts from examples/base-path

npm run serve

@adamdicarlo0
Copy link
Contributor

adamdicarlo0 commented Sep 18, 2023

I just ran into this, too, on Elm Pages v3.0.8.

I can't seem to work around it, either. I tried copying dist/* into dist/app/ (I was trying to use --base app), and noticed something interesting: the modulepreload for elm.<hash>.js is correct, but the actual script tag for it is not:

image

also, the "No route found for" message makes it look like the routing is not ignoring the base path (not sure whether that's a problem in the routing or the error message).

@declension
Copy link

Also seeing this - first sign is getting a "page not found" for the root path.

And aside: I just ❤️ that this issue number is... 404!

@hahnah
Copy link

hahnah commented Jan 20, 2025

I also see this problem with elm-pages 3.0.20.

This problem makes it impossible to deploy site on GitHub Pages with base path.

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