I was having a similar problem while creating an example for my new book (currently in beta) Mastering Building Web Assembly Apps using Rails.
I am using Rails8 which creates a new app using Propshaft and Importmaps by default to manage static assets and JS libraries respectively. I tried creating a controller with an action to provide WASM module as an asset but it didn't work thus i had to modify my WASM module's .js gluecode.
The whole instructions are in the book available for free to read. May be it might of any help to you.