dillonkearns/elm-pages

Broken `elm-pages build --base` - only changes outputs partially

georgesboris opened this issue · 3 comments

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)

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

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).

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!