I don’t have the full context of your application, but, generally speaking, any JS code can be packaged into modules. What makes it not work for you?
Importing JS using ERB to look up file paths looks like that might be painful. If it were my application, I might be looking to distribute my gem as two distinct distributions; Ruby from rubygems (or a private gem repository) and the JS as a package on NPM (or private NPM repository).