I tried that - but I get an “unexpected reserved word” error because the ES6 module doesn’t get transpiled.
The last comment on that issue says that shouldn’t be needed.
Between this issue and the fact that you also can’t pull in unnamed AMD/UMD modules (which are very common) - it seems incredibly difficult to pull 3rd-party modules into Ember CLI.
Just curious any reason why this module needs to sit in the node_modules?
The 2 approaches I have taken to this problem is one
place the modules in the bower_components folder and then do the app.import
I know I don’t get the benefit of installing it with bower install but it was something I could live with.
Place the module inside the app folder. I added a Util folder to my app to manage modules I write.
util/plugin.js
import Ember from 'ember';
//Manages an object ajax request
import 'project/utils/plugins/apiRequest';
//Sets an active class to or takes away from targeted div
import 'project/utils/plugins/toogleActive';
//vaildate product fields
import 'project/utils/plugins/validateProduct';
Then of course I can reference those modules when i need them
import '../utils/plugins';
I’m not sure if this is the best route just the only one I have found to work. Im not exactly sure this fits your use case. but I was pretty frustrated with a similar problem for some time.
@artsmc88 I never said it needs to sit in node_modules. Please read my previous posts closely - app.import does not work for ES6 modules. My original post noted that placing the module inside the app folder works fine.
well I guess the simple answer to the question is no.
you can use the other options or make a emberaddon. I dunno i think that placing it inside the app folder makes more sense for organization, so i was wondering if you had a use case?
Same here; I would expect that I can create an ES6 module, put it into the bower_components directory and then have it transpiled automatically into the app somehow. This is something that should be really simple and has proven very frustrating. Simply put: if I have my own ES6 module, how to I use it in my ember app?
@jackmatt2 Unfortunately not. We’ve elected to stay away from Ember for now, largely due to the inflexibility of the build process with issues like this.
Any reason why you are asking if the module needs to sit in the node_modules ?
I mean can we not use app.import for node_modules like we do for bower_components ?
If no, what is the correct way to use Node packages (or 3rd party libraries)?
Does anyone know if there has been any progress related to this? I am learning Ember and attempting to use it in my electron-based application but getting extremely mixed up between the various module systems, ES2015 import/export via Babel with Ember, require made available via electron, require made available via node, … Any help or advice would be appreciated.