biff

Epidiah Ravachol 2024-05-04T14:45:31.698559Z

I have a bit of a head-scratcher here. My homepage is suddenly returning:

<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no">
  </head>
  <body>
    <div id="app"> </div>
    <script src="dev/main.js" type="text/javascript"></script>
  </body>
</html>
Which looks nothing like anything any of my handlers return. I was working a different handler in a different namespace/file when this happened and I'm having some trouble figuring out where this is coming from. I don't, for example, have a div anywhere with the id app or any main.js file. Any clue where this might be coming from?

2024-05-04T15:34:00.719929Z

maybe there's a file in resources, either in your app or in a dependency you've added? you can call ( "public/index.html") and see if it returns anything.

1
Epidiah Ravachol 2024-05-04T15:46:12.558239Z

That was it! It was in a library that I was trying out, but decided against using and just hadn't gotten around to removing it from my deps.edn. I removed it and it's all working as expected now. Thanks! Is there a way to circumvent that, though? In case another library I do want to use has a similar set up?

2024-05-04T15:53:21.865809Z

great! honestly the main way is probably to ask the library author to move the file to a namespaced location, like resources/my/library/public/index.html. as a workaround you can fork the library and do it yourself. it's ok for applications to put stuff in E.g. resources/public/index.html but a library should never do that. it'd be like having a library source file at src/core.clj instead of src/com/example/core.clj

2024-05-04T16:00:56.539609Z

another solution/workaround is you could move your app's resources/public directory to a namespaced location instead, like resources/com/example/public. and then set :biff.middleware/root "com/example/public" in resources/config.edn

👍 1