小编Kam*_*zyk的帖子

在ember js中导入模块时出现异常

我需要在emberjs app中删除字符串中的变音符号.我发现了一个插件:fold-to-ascii 但我不知道如何在我的应用程序中使用它.

我通过npm添加了这个插件,它在我的应用程序中的node_modules文件夹下可见

在docs中,这个插件的用法是:

var foldToAscii = require("fold-to-ascii");
foldToAscii.fold("?Lorém ïpsum dölor.")
Run Code Online (Sandbox Code Playgroud)

但我得到一个例外:

Uncaught Error: Could not find module fold-to-ascii
Run Code Online (Sandbox Code Playgroud)

也尝试导入它像@Kori约翰罗伊斯建议:

import foldToAscii from 'fold-to-ascii'
Run Code Online (Sandbox Code Playgroud)

但它只给我一个新的例外:

Error while processing route: transports.index Could not find module fold-to-ascii imported from test-ember/pods/transport/model

我究竟做错了什么 ?

javascript plugins require npm ember.js

1
推荐指数
1
解决办法
917
查看次数

标签 统计

ember.js ×1

javascript ×1

npm ×1

plugins ×1

require ×1