我是Ruby on Rails的新手,我试图使用Noty实现通知,但失败了。
安装过程:
本地主机已停止
$ yarn add noty
# app/javascript/packs/application.js
...
window.noty = require("noty")
下面我无法导入noty
#app/assets/stylesheets/application.scss
...
@import "noty/lib/noty.js"; # not working
@import "noty/lib/noty"; # not working either
我可以确认该库在package.json和yarn.lock中声明了
我还看到了this possible solution,并且在我的asset.rb中,已经引用了node_modules ...
Rails.application.config.assets.paths << Rails.root.join('node_modules')