简体   繁体   中英

exception while importing module in ember js

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 ?

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM