【发布时间】:2018-11-11 14:45:58
【问题描述】:
我正在尝试制作 noty.js (https://ned.im/noty/#/installation - 通知库)可以在我的 Rails 应用程序中使用。
我已经用 npm 安装了它
npm install noty
现在,它出现在node_modules 下。
当我尝试使用
new Noty({
text: 'Some notification text'
}).show();
我会得到' Uncaught ReferenceError: Noty is not defined'
如果我尝试在我的 js 文件中导入它: import Noty from 'noty' ;我会得到'Uncaught SyntaxError: Unexpected identifier'(我的'noty'路径是可见的-我可以被引导到它)。
我怎样才能让它正常工作?
【问题讨论】:
-
你在使用 webpack 吗?
-
@DanielWestendorf No.
标签: javascript jquery ruby-on-rails ruby npm