nikushi / minipack

Minipack, a gem for minimalists, which can integrates Rails with webpack. It is an alternative to Webpacker.
MIT License
114 stars 22 forks source link

base_path doesnt seem to work #28

Closed adin-ttc closed 4 years ago

adin-ttc commented 4 years ago

the manifest file is located correctly and the result of

javascript_bundle_tag 'index'

always outputs /javascript/index.myhash.js

I expected altering the base_path to change the /javascript/ part to the path that I provided

nikushi commented 4 years ago

Do you mean that base_path in your comment points to the configuration parameter described in README?

  # The base directory for the frontend system. By default, it will be
  # `Rails.root`.
  # c.base_path = Rails.root
  #
  # Suppose you want to change the root directory for the frontend system such as `frontend`.
  # Note that a base_path can be a relative path from `Rails.root`.
  # c.base_path = 'frontend'

If so, it is not for what you want to configure. Internally, javascript_bundle_tag is just a wrapper of javascript_include_tag, provided by pure Rails.

https://github.com/nikushi/minipack/blob/master/lib/minipack/helper.rb#L24

Finally the helper methods provided by minipack delegate to asset_path, so https://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html#method-i-asset_path may help you.