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

compute_asset_path does not update when using jsbundling + esbuild #106

Open
michelson opened this issue Mar 28, 2022 · 1 comment
Open

Comments

@michelson
Copy link

michelson commented Mar 28, 2022

Hello, I have a script that is accessed by clients via GET /embed.js, I have a controller that does the redirect to the precompiled asset, so it redirects to /embed-[the-hashed-id].js This works in production but in development environment the method ActionController::Base.helpers.compute_asset_path does return an old version hash on filename after a esbuild build. My workaround right now is to restart the server, then the hash changes correclty.
This worked as expected with webpacker. the problem started when I've integrated esbuild with js-bundling

Any idea what could be the problem?

example controller:

  def show
    respond_to do |format|
      format.js { redirect_to widget_javascript_source }
    end
  end

  private

  def widget_javascript_source
    ActionController::Base.helpers.compute_asset_path("embed.js", debug: true)
  end
@michelson
Copy link
Author

I'm seeing the same with ActionController::Base.helpers.asset_path("embed.js", debug: true) , it does not update the hash after a build.

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

1 participant