Kamil Ruszczyk
Kamil Ruszczyk

Reputation: 305

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 ?

Upvotes: 1

Views: 1307

Answers (1)

Kori John Roys
Kori John Roys

Reputation: 2661

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"

Upvotes: 5

Related Questions