Had to restart server after unpinning an importmap. Is this expected?

Noticed that the server had to be restarted after unpinning an importmap. But there is no need to restart when pinning.

Is this expected? Does it deserve a github issue?

What do u mean “it had to be restarted”?

I mean in one terminal I am doing $ rails s Then in another terminal I am doing $ bin/importmap unpin X Then I have to return to the first terminal, stop the server with Ctrl+C and start it again with $ rails s

And you mean that the server stops working? Or that the library is still available even if its unpinned?

  1. Start server.

  2. You pin.

  3. Everything is fine. No need to restart. New pin is available

  4. Start server

  5. You unpin

  6. Things are not fine. The library that was just unpinned is still used when viewing the importmap in the browser. You have to restart the server and only after than the library that was unpinned is no longer available int he importmap used by the browser.

(btw, do you know how to view the importmap in the browser? Should I add a screenshot here)

At least according to the gem’s README, it’s “expected”.

The import map is setup through Rails.application.importmap via the configuration in config/importmap.rb . This file is automatically reloaded in development upon changes, but note that you must restart the server if you remove pins and need them gone from the rendered importmap or list of preloads.

While “expected” I’m sure it’s not ideal, but I suppose DHH and co haven’t found a suitable solution around this limitation.


Thanks. That was helpful.