Rendering js from a Rails controller with webpacker

前端 未结 2 954
南笙
南笙 2021-02-05 18:11

Just replaced the js pipeline in my Rails app with webpacker.

Most things work correctly, however controllers that render js no longer work as expected.

2条回答
  •  执念已碎
    2021-02-05 18:48

    I had a similar problem where I had undefined $ on the string $("#element").html(

    My configuration is similar to yours I solved by exposing at the end of the file pack/application.js

    windows.jQuery = jQuery
    window.$ = $
    

提交回复
热议问题