You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! I'm trying to use Snowpacker with Hanami and I finally managed to get it to work, but I needed to add two hacks to Snowpacker to achieve that. I wonder what would be your ideas for proper fixes.
Hack 1: 304 + Content-Type
When I reload the page and Snowpack server returns 304 (file not changed), Rack complains about it with an exception:
Rack::Lint::LintError: Content-Type header found in 304 response, not allowed
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:21:in `assert'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:710:in `block in check_content_type'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:706:in `each'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:706:in `check_content_type'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:70:in `_call'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/lint.rb:38:in `call'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/show_exceptions.rb:23:in `call'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rack-2.2.3/lib/rack/handler/webrick.rb:95:in `service'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run'
/home/katafrakt/.rbenv/versions/2.6.6/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'
I hacked it by modifying proxy.rb and adding this to the end of perform_request:
re = super(env)
if re[0] == 304
re[1].delete('content-type')
end
re
else
Hack 2: /web_modules
I'm trying to use Vue 3 with it. To achieve that I had to reroute /web_modules too in Rack proxy. This hack is in the beginning of perform_requests:
@katafrakt first of all, really cool that you're trying out Snowpacker. Unfortunately, this gem is also wildly incomplete in its current state. I didn't expect anybody to be using it yet to be honest.
As for fixes, I have never personally used Hanami so I'd have to look into it a little further...I also haven't tested it with SPAs yet...
Like I said this project isn't really ready to be used in its current state, but I do appreciate being made aware of these issues. I'm going to leave this issue open for when I get around to testing it.
I think these aren't really Hanami-related, just non-Rails related, and should also happen in Sinatra or Roda. I can check that. For the first issue (304), I suspect that Rails has some extra middleware which fixes it.
Anyway, if you need any help, let me know. Hanami is currently missing any kind of modern frontend stack integration and I think Snowpack looks far more promising than Webpack.
@katafrakt good to know...I did not realize this was an issue with Hanami. I imagine this also rings true for Sinatra.
As of right now, the Snowpacker development is "halted" because I'm working on a Snowpack plugin to bundle for production which will include a Manifest of assets as well as
I'll definitely let you know should anything come up as to any issues I may need help with.
Thank you again for the feedback and I'll work on making sure these are non-issues in the future!
Hey! I'm trying to use Snowpacker with Hanami and I finally managed to get it to work, but I needed to add two hacks to Snowpacker to achieve that. I wonder what would be your ideas for proper fixes.
Hack 1: 304 + Content-Type
When I reload the page and Snowpack server returns 304 (file not changed), Rack complains about it with an exception:
I hacked it by modifying
proxy.rb
and adding this to the end ofperform_request
:Hack 2: /web_modules
I'm trying to use Vue 3 with it. To achieve that I had to reroute
/web_modules
too in Rack proxy. This hack is in the beginning ofperform_requests
:I know both of these are stupid, but with that it works, so they can be a starting point to find proper solutions.
Thanks for this project, by the way!
The text was updated successfully, but these errors were encountered: