exception while importing module in ember js

不羁岁月 提交于 2020-01-06 03:30:07

问题


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.

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.")

but i get an exception:

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

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

What am I doing wrong ?


回答1:


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"


来源:https://stackoverflow.com/questions/29672404/exception-while-importing-module-in-ember-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!