在ember js中导入模块时出现异常 [英] exception while importing module in ember js

查看:95
本文介绍了在ember js中导入模块时出现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to remove diacritics from string in emberjs app. I found a plugin for this: fold-to-ascii but I don't know how to use it in my app.

我通过npm添加了此插件,该插件在我的应用程序的node_modules文件夹下可见

I added this plugin via npm and it is visible under node_modules folder in my app

在文档中,此插件的用法是:

In docs usage of this plugin is:

var foldToAscii = require("fold-to-ascii");
foldToAscii.fold("★Lorém ïpsum dölor.")

但我得到一个例外:

Uncaught Error: Could not find module fold-to-ascii

还尝试像@Kori John Roys建议的那样导入它:

also tried importing it like @Kori John Roys suggested:

import foldToAscii from 'fold-to-ascii'

但是它给了我一个新的例外:

but it gives me only new exception:

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

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

我在做什么错了?

推荐答案

假设您使用的是ember-cli:

Assuming you are using ember-cli:

npm install --save-dev ember-browserify

然后您可以像这样导入:

then you can import like this:

import foldToAscii from "npm:fold-to-ascii"

这篇关于在ember js中导入模块时出现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆