Ember error: path "vendor/loader.js/loader.js" did not match any files - ember.js

Building off: Ember-cli - Bower not installing properly
I just upgraded from ember-cli 0.0.40 to 0.1.2 and when I run the ember server I also have an issue with moment. 48 JSHint Errors of Bad option: 'moment'.
After JSHint is done letting me have it, I did a bad path error for loader.js:
Path or pattern "vendor/loader.js/loader.js" did not match any files
Error: Path or pattern "vendor/loader.js/loader.js" did not match any files
at Object.multiGlob (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-kitchen-sink-helpers/index.js:221:13)
at /home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/broccoli-concat/index.js:62:32
at $$$internal$$tryCatch (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invokeCallback (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:482:17)
at $$$internal$$publish (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:453:11)
at $$rsvp$asap$$flush (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1531:9)
at process._tickCallback (node.js:419:13)
Before upgrading to ember-cli#0.1.2 I was getting an includes error for ember-cli-simple-auth. I did do ember g ember-cli-simple-auth and that's nifty, but the above error persists.

Make sure to follow the steps on the releases page to have a solid upgrade.
Specifically in your case, this is likely caused by an app.import in your Brocfile.js. One of the big changes was that bower components were moved to /bower_components instead of /vendor. That error says that something is trying to import loader.js from the vendor directory.
It could be caused by you trying to import it in your Brocfile or due to ember-cli not being updated properly in your node_modules folder. If it still references the old version, it will try to import from vendor/ instead of bower_components. To fix that, just rm -rf node_modules and npm install to reinstall the modules.
The releases page mentions how to clear your npm cache to reinstall everything if you are still having trouble.

Related

Metro Bundler fails while trying to resolve module `immer` from redux-toolkit

I'm building a react native app using Expo and Expo Go to test it on an android device. It has been working flawlessly until today. I encoutered an error on one of my components with this kind of error:
Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' on a null object reference
Solution seemed to me to clear cache yarn cache clean. I also cleared cache on the Expo Go app. But this led me to Metro Bundler failing with this error:
Android Bundling failed 1279ms
While trying to resolve module `immer` from file `H:\my_project\app\node_modules\#reduxjs\toolkit\dist\redux-toolkit.cjs.production.min.js`, the package `H:\my_project\app\node_modules\immer\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`H:\my_project\app\node_modules\immer\dist\immer.esm.mjs`. Indeed, none of these files exist:
* H:\my_project\app\node_modules\immer\dist\immer.esm.mjs(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
* H:\my_project\app\node_modules\immer\dist\immer.esm.mjs\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
When checking H:\my_project\app\node_modules\immer\dist\, I do find an immer.esm.mjs file but no H:\my_project\app\node_modules\immer\dist\immer.esm.mjs\ folder with an index file in it.
So I tried to manually remove node_modules/ and reinstall packages with yarn, restart the Expo server, doing all this after restarting my machine, even ran expo upgrade, removed .expo/, removed yarn.lock, but I keep getting the same error.
This leaves me quite confused. Thank you for your suggestions on what to do.
Here are the dependencies versions used as in my package.json:
"#reduxjs/toolkit": "^1.8.1",
"#types/react-redux": "^7.1.22",
"expo": "~45.0.0",
"react": "17.0.2",
"react-native": "0.68.2",
"react-redux": "8.0.1",
"redux": "4.2.0"
Fix
As suggested in this redux-toolkit issue, there seems to be an issue with immer version 9.0.13. Temporary fix suggested there is working for me, adding immer#9.0.12 to my resolutions in packages.json:
"resolutions": {
"immer": "9.0.12"
}
Update
This PR on immer resolved this issue (9.0.14). I can confirm the above fix isn't needed anymore on my side. Looks like my bad luck came from some breaking changes being pushed on a minor release.

Ember serve doesn't work (Error: Couldn't find preset "es2015")

I am building a web app using Ember. I created the project with ember new test-app and have made no changes to the generated files. When I run ember serve, I immediately receive the following error:
The Broccoli Plugin: [BroccoliMergeTrees: Addon#compileAddon(ember-welcome-page) ] failed with:
Error: Couldn't find preset "es2015" relative to directory "/Users/jacob"
at /Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map ()
at OptionManager.resolvePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Promise (/Users/jacob/Desktop/test-app/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:102:26)
The broccoli plugin was instantiated at:
at BroccoliMergeTrees.Plugin (/Users/jacob/Desktop/test-app/node_modules/broccoli-plugin/index.js:7:31)
at new BroccoliMergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:16:10)
at Function.BroccoliMergeTrees [as _upstreamMergeTrees] (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:10:53)
at mergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/broccoli/merge-trees.js:85:33)
at Class.compileAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:1092:12)
at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:746:26)
at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-welcome-page/index.js:27:41)
at Class.superWrapper [as treeForAddon] (/Users/jacob/Desktop/test-app/node_modules/core-object/lib/assign-properties.js:34:20)
at Class._treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:557:33)
at Class.treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:517:21)
I referred to this question for help, but I still received the same error after trying the solution.
I am running ember-cli v2.16.2 and node v8.9.0 on macOS High Sierra. In my node installation, the only three global modules I have installed are bower, broccoli-cli, and ember-cli.
Please do clean reinstall of ember-cli package.
npm uninstall -g ember-cli
npm cache clean --force
npm install -g ember-cli
Then run your ember new command once again and test it.

ember-cli cleanup error when building

I had ember-cli installed on my computer and my app was running perfectly, but yesterday I formatted my computer and upgraded to windows 10 and tried to install ember-cli exactly the same way it was before but now when I try to build or run my application I get this error:
Future versions of Ember CLI will not support v4.2.1. Please update to Node 0.12 or io.js.
version: 1.13.8
Cleanup error.
ENOTEMPTY: directory not empty, rmdir 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-output_path-jfPUvJvW.tmp'
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-output_path-jfPUvJvW.tmp'
at Error (native)
at Object.fs.rmdirSync (fs.js:763:18)
at rmkidsSync (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:247:11)
at rmdirSync (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:237:7)
at fixWinEPERMSync (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:150:5)
at Function.rimrafSync [as sync] (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:216:26)
at Object.remove (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\index.js:26:12)
at ReadCompat.cleanup (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\read_compat.js:69:13)
at ConcatWithMaps.Plugin.cleanup (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\index.js:113:49)
at cleanupTree (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli\lib\builder.js:147:17)
Build failed.
ENOENT: no such file or directory, open 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\ember-basic-dropdown\components\basic-dropdown.js'
Error: ENOENT: no such file or directory, open 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\ember-basic-dropdown\components\basic-dropdown.js'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at SourceMap.addFile (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\fast-sourcemap-concat\lib\source-map.js:68:19)
at ConcatWithMaps.<anonymous> (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\concat-with-maps.js:96:17)
at Array.forEach (native)
at ConcatWithMaps.addFiles (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\concat-with-maps.js:93:9)
at ConcatWithMaps.build (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\concat-with-maps.js:65:8)
at C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\index.js:152:21
at lib$rsvp$$internal$$tryCatch (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\rsvp\dist\rsvp.js:493:16)
node v4.2.1
npm v2.14.7
But I've tried with others versions and the problem persisted.
The same application is working perfectly on another computer which also has windows 10 and the same node and npm versions.
If you need any extra information leave a comment and I'll edit the question.
I had the same problem today. It seems there's a bug in a dependency module:
"name": "fast-sourcemap-concat",
"version": "0.2.6"
it does not handle properly Windows paths starting with drive letters, like C:/.
For now, I fixed it manually in fast-sourcemap-concat/lib/source-map.js, function _resolveFile, line 55, changing:
if (this.baseDir && filename.slice(0,1) !== '/') {
to:
if (this.baseDir && filename.slice(0,1) !== '/' && filename.slice(1,3) !== ':/') {
Seems to fix the issue for me. Good luck!
This was fixed in https://github.com/ember-cli/ember-cli/issues/5055
You will need to reinstall your node modules:
rm -rf node_modules
npm cache clear
npm install
Try to reinstall Ember CLI in your project directory (local version). You can follow the steps from Ember CLI GitHub releases page - start with rm -rf node_modules bower_components dist tmp and continue following Project Update guide.

Warning route-recognizer

I need some help here..
Just updated my ember-cli to 0.1.9 version and the only problem is this warning:
Warning: ignoring input sourcemap for
bower_components/route-recognizer/dist/route-recognizer.js because
ENOENT, no such file or directory
'/Users/Zaca/Eyenetra/portal/tmp/tree_merger-tmp_dest_dir-kOIywY0K.tmp/bower_components/route-recognizer/dist/route-recognizer.js.map'
Here's my call to this addon on brocfile.js:
//brocfile.js
(...)
app.import('bower_components/moment/moment.js');
app.import({development: 'bower_components/route-recognizer/dist/route-recognizer.js'});
app.import({development: 'bower_components/FakeXMLHttpRequest/fake_xml_http_request.js'});
app.import({development: 'bower_components/pretender/pretender.js'});
module.exports = app.toTree();
This happens when I build my project for tests and for local server.
Any ideas?
Thanks for the help! o/
We have actually moved away from using Pretender, since at the moment we always have a staged API up and running.
In doing that, we removed the following from our Brocfile:
app.import({development: 'bower_components/route-recognizer/dist/route-recognizer.js'});
app.import({development: 'bower_components/FakeXMLHttpRequest/fake_xml_http_request.js'});
app.import({development: 'bower_components/pretender/pretender.js'});
With that the warning went away.
Aside: I'm unsure of the implications of not having route-recognizer there, but so far there has been no effect without it.
I'm still getting this problem, even after deleting my component and tmp folders and cleaning my caches. However, looks like this is a known issue that a lot of other people are having as well:
https://github.com/tildeio/route-recognizer/issues/44
I will be watching this to see when an update comes out. In the meantime I guess I will just have to live with the warning.
There is already a temporary fix here:
https://github.com/tildeio/route-recognizer/pull/45/files
After some cleanup, this warning message never happened again.
To really cleanup, you have to do these steps:
rm -rf bower_components/
rm -rf dist
rm -rf node_modules/
rm -rf tmp
npm cache clean
bower cache clean
And, after, the normal install steps
npm install
bower install
Hope that work for analog situations =)
I found that doing an ember install of some dependencies worked.
We had mirage and yadda dependencies. I did
ember install ember-cli-mirage
ember install ember-cli-yadda
and then
ember build
Built project successfully. Stored in "dist/"
You do some great things with ember and then there are days like this.

How to use third party npm packages with ember cli app

EDIT: this is actually about any npm package which is not designed to play along with ember. In my case, I tried to make crypto-js work, but it seems to be always the same trouble with any npm package not specially designed for ember cli.
I want to use cryptoJS in my ember app, which I'm currently refactoring with ember cli, but I'm having a lot of trouble importing all the third party packages and libraries I'm already using, like for example cryptoJS.
CryptoJS at least has a package for npm, I don't even want to think about what happens if some of my included libraries don't have a package...
Am I just missing the point in the documentation of ember-cli or is it really not described how to import other npm packages and also how to inlcude non-package libraries properly to keep them under version control and dependency control?
If I follow the description of the crypto-js package manual:
var CryptoJS = require("crypto-js");
console.log(CryptoJS.HmacSHA1("Message", "Key"));
I get and error in my ember build
utils/customauthorizer.js: line 1, col 16, 'require' is not defined.
Thanks for any help on this, I'm very excited about the ember cli project, but importing my existing ember app has been quite painful so far...
EDIT:
Just importing unfortunately does not work.
import CryptoJS from 'crypto-js';
throws during the build
daily#dev1:~/VMD$ ember build
version: 0.1.2
Build failed.
File: vmd/utils/customauthorizer.js
ENOENT, no such file or directory '/home/daily/VMD/tmp/tree_merger-tmp_dest_dir-F7mfDQyP.tmp/crypto-js.js'
Error: ENOENT, no such file or directory '/home/daily/VMD/tmp/tree_merger-tmp_dest_dir-F7mfDQyP.tmp/crypto-js.js'
at Error (native)
at Object.fs.statSync (fs.js:721:18)
at addModule (/home/daily/VMD/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:84:46)
at addModule (/home/daily/VMD/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:133:9)
at addModule (/home/daily/VMD/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:133:9)
at /home/daily/VMD/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:59:7
at $$$internal$$tryCatch (/home/daily/VMD/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invokeCallback (/home/daily/VMD/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:482:17)
at $$$internal$$publish (/home/daily/VMD/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:453:11)
at $$rsvp$asap$$flush (/home/daily/VMD/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1531:9)
The easiest and recommended answer is to use ember-browserify. (as support for bower packages will be removed in the future.)
This is an example for using the npm package dexie within an Ember CLI app.
Install browserify: npm install ember-browserify --save-dev
Install dexie (or whatever module you need): npm install dexie --save-dev
Import the module like this: import Dexie from 'npm:dexie';
UPDATE (April 2021):
ember-browserify has now been is deprecated in favor of either ember-auto-import or ember-cli-cjs-transform
(see the deprecation warning at the top of ember-browserify)
UPDATE: I got this to work much better and straight forward! Thanks to the comment of #j_mcnally!
Will leave the first answer down there so everyone can see what trouble I was coming from :)
What I did:
bower install crypto-js=svn+http://crypto-js.googlecode.com/svn/#~3.1.2 --save
In my file Brocfile.js I could just do app.import('bower_components/crypto-js/build/rollups/hmac-md5.js');
No manual downloading or moving files, just managing a dependency, much better solution!
But honestly, it was still a lot of vodoo! Until I found the documentation... sweet: http://bower.io/docs/api/#install
OLD approach
I got this to work, but I can not tell how pretty or correct that approach is. Including third party packages or libraries with ember cli is pretty far away from straight forward or self explaining.
The ressources which led me to my working solution were:
how to use third party javascript from ember-cli route
https://github.com/stefanpenner/ember-cli/issues/757
The following steps I took to get it working:
I manually downloaded the library https://code.google.com/p/crypto-js/downloads/detail?name=CryptoJS%20v3.1.2.zip and unziped it
I manually created a directory in my vendor directory: mkdir vendor/crypto-js
I appended app.import('vendor/crypto-js/hmac-md5.js'); to the Brocfile.js file
I added "CryptoJS" to the "predef" key in the .jshintrc file
Then the build worked and I could eventually use the library.
Sadly I didn't get the npm package to work! I had to manually download the zip file, unzip it and move it to the correct location and if the version changes, it's not under any version/dependency control... I will not mark this as an answer, since it does not satisfy me at all, but at least I wanted to share what I did to make it work for me.
As Timm describes, using browserify gets the code injected into your ember app. However, I was having trouble actually using the injected module. In order to do that I had to actually create the module with New before I could use it:
In order to import an NPM module.
1) install browserify:
npm install ember-browserify --save-dev
2) install your modele:
npm install my-module --save-dev
3) Import your module into your ember file of interest (app/controller/post.js):
import Module from 'npm:my-module';
4) use the module from within your code by creating the module with New:
var output = new Module(var1, var2, etc.);
even though this is an old thread thought I would contribute as I spent a while doing this. The specific package I was trying to link to ember was 'd3plus' and had to do a variety of things to get it to work.
npm install ember-browserify --save-dev
npm install d3plus --save-dev
ember install ember-cli-coffeescript
npm install --save-dev coffeeify coffeescript
then in your component do
import d3plus from 'npm:d3plus';
For a long time I was getting runtime errors when it was searching for the coffescript and figured this would be helpful for people specifically looking for d3plus.
As stated by Pablo Morra on a comment of the simplabs' post "Using npm libraries in Ember CLI", third party npm modules can be imported on Ember.js from version 2.15 directly without the need of addons or wrappers:
https://www.emberjs.com/blog/2017/09/01/ember-2-15-released.html#toc_app-import-files-within-node_modules
Unfortunately documentation is still on work and it doesn't say that npm modules can be imported, only bower and vendor ones:
https://github.com/emberjs/guides/issues/2017
https://guides.emberjs.com/v3.0.0/addons-and-dependencies/managing-dependencies/
I've gotten 2 solutions to import third party npm modules directly on Ember.js from the Ember CLI documentation about managing dependencies, although it's also out-of-date and says that npm modules can't be imported, only bower and vendor ones:
npm module as Standard Anonymous AMD Asset
https://ember-cli.com/managing-dependencies#standard-anonymous-amd-asset
AMD: Asynchronous Module Definition
I prefer and use this way because it avoids global variables and follows the import convention of Ember.js.
ember-cli-build.js:
app.import('node_modules/ic-ajax/dist/amd/main.js', {
using: [
{ transformation: 'amd', as: 'ic-ajax' }
]
});
amd is the type of transformation applied, and ic-ajax is the module name to be used when it's imported on a javascript file.
on Ember.js javascript file (router, component...):
import raw from 'ic-ajax';
// ...
icAjaxRaw( /* ... */ );
raw is a module exported by ic-ajax.
That's the way it worked for me although the Ember CLI documentation shows the import other way that didn't work for me, maybe because of the specific package I was importing:
import { raw as icAjaxRaw } from 'ic-ajax';
//...
icAjaxRaw( /* ... */ );
npm module as global variable
https://ember-cli.com/managing-dependencies#standard-non-amd-asset
ember-cli-build.js:
app.import('node_modules/moment/moment.js');
on Ember.js javascript file (router, component...):
/* global moment */
// No import for moment, it's a global called `moment`
// ...
var day = moment('Dec 25, 1995');
/* global moment */ is an annotation for ESLint not to show an error when building the project because moment() is not defined in the file.
npm module as Standard Named AMD Asset
https://ember-cli.com/managing-dependencies#standard-named-amd-asset
Ember CLI also shows a third option that didn't work for me, maybe because of the specific package I was importing:
ember-cli-build.js:
app.import('node_modules/ic-ajax/dist/named-amd/main.js');
on Ember.js javascript file (router, component...):
import { raw as icAjaxRaw } from 'ic-ajax';
//...
icAjaxRaw( /* ... */ );
npm module as AMD JavaScript modules
https://guides.emberjs.com/v3.0.0/addons-and-dependencies/managing-dependencies/#toc_amd-javascript-modules
The way described on Ember.js documentation about Managing Dependencies didn't work for me either, maybe because of the specific package I was importing:
ember-cli-build.js:
app.import('node_modules/ic-ajax/dist/named-amd/main.js', {
exports: {
'ic-ajax': [
'default',
'defineFixture',
'lookupFixture',
'raw',
'request'
]
}
});
on Ember.js javascript file (router, component...):
import { raw as icAjaxRaw } from 'ic-ajax';
//...
icAjaxRaw( /* ... */ );