How to import assets outside of fastboot, that live in the public directory


#1

I have an application (not an addon) that needs to import a library, which must run outside of Fastboot. I have put this library into /public/myOtherLibrary and the assets export fine into my application.

In my ember-cli-build.js I have tried all of the following:

app.import('vendor/public/myOtherLibrary/custom.js');
app.import('public/myOtherLibrary/custom.js');
app.import('myOtherLibrary/custom.js');

let library = path.join(this.app.project.root, 'public', 'myOtherLibrary');
app.import(path.join(library, 'custom.js'));

But none of these result in the content being exported into the application (either as a separate file, or by being bundled into the vendor.js).

When I dump the files into a directory under node_modules everything works beautifully just doing: app.import('node_modules/myOtherLibrary/custom.js');

My problem is that this library does NOT have a npm or similar wrapper available, so I can’t import it from there. Similarly, because I ultimately need the if (!process.env.EMBER_CLI_FASTBOOT) { } wrapper around the import, I can’t just include it in my index.html

Ultimately I just need a way to add these Javascript files to my application, but only when it is not running under Fastboot. If someone could please provide a way of doing that (apologies my experience in ember is limited, so if you could be specific as to what files to edit where that would be helpful)?

ember-cli: 2.15.1

ember-cli-fastboot: 1.1.3