1
votes

I am trying to use an npm module in a component so I installed ember-browserify to be able to import the module, but for some reason it is not being found.

This is how I am trying to import it:

import dropzone from 'npm:dropzone'

this is the error I am getting

Uncaught Error: Could not find module `dropzone` imported from `<Project Name>/components/drop-zone/component`

I don't think it's supposed to be looking for the module there.

I have the npm in the package.json

Do I need to install something else? Is there an extra step I am missing?

EDIT: this is an ember-cli addon

1

1 Answers

1
votes

To use the 'npm:' shortcut you need the awesome ember-browserify addon. Don't forget to star it!

Simply install it into your project via ember install ember-browserify, restart the dev server and it'll work.

Provided that you've had installed the dependency via npm install --save-dev dropzone, of course. ;)