Quantcast
Viewing all articles
Browse latest Browse all 4828

Correct way to load module from node_modules

@MrChriZ wrote:

I’m slightly confused as to the correct way to load a module from node_modules in one of my controllers. I’ve added aws-sdk using yarn which has installed it in node_modules. I’m using Ember 3.0 The documentation for managing dependencies here: https://guides.emberjs.com/v3.0.0/addons-and-dependencies/managing-dependencies/

Talks at great lengths about bower. However from my understanding Bowers actually being phased out?

I’ve tried simply import {AWS} from 'aws-sdk'; or various versions of import {AWS} from 'node_modules/aws-sdk'; that results in ‘could not find module’ errors.

Having googled a lot I’ve found various different methods that might work

  • Ember-Browserify
  • Creating a vendor shim? (I don’t really understand why this would be necessary if what I’m importing is already in a module format)
  • Use app.import in ember-cli-build.js - but would this then import it globally?

I’m not certain on is what is the current way of doing this.

This seems like a very basic fundamental thing to want to do - I’m curious why the documentation seems to not be very helpful on this front - is it awaiting updating? - am I missing something?, or looking at this in the wrong way?.

Thanks, Chris.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles