sodapopcan
Serving root level static assets when a match all route
I have a LiveView with a router that matches on any /:token given as the first part of the path. This is causing static assets in the root dir like /favicon.ico and /robots.txt to match this route. Is there any way around this?
Thanks!
First Post!
LostKobrakai
Plug.Static should come before your router in endpoint.ex. If there’s no actual file though it’ll move on to the router.
Most Liked
kokolegorille
It also depends on the version of CopyWebpackPlugin… Phoenix use 5.x syntax, but if You are using 6.x branch of the webpack plugin, You need to update webpack.config.js to…
# old syntax
new CopyWebpackPlugin([{ from: "static/", to: "./" }]),
# new 6.x syntax
new CopyWebpackPlugin({
patterns: [{ from: "static/", to: "./" }]
}),
This plugin is in charge of copying what is in assets/static to priv/static. You should not touch priv/static, and just put into assets/static
sodapopcan
Yes! I juuuust realized this (see my answer above). But thank you! I wasn’t 100% sure that’s what happened and now you’ve confirmed for me ![]()
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









