Jamesla
Jamesla

Reputation: 1408

What is the correct way to add js libraries to mean.io applications?

I am trying to add underscore to my mean.io application. I'm not sure where to link the js library to the page as it doesn't have a main html page like the Angular generator does.

I manually added it via the config/assets.json file and it works however the dev server keeps crashing saying _ is undefined (even though the web app uses the _ function ok and returns the data just before the dev server stops).

I asume I must be doing this wrong.

What is the correct way to add custom js libraries to a mean.io project?

Upvotes: 0

Views: 418

Answers (1)

Atanas Kerezov
Atanas Kerezov

Reputation: 11

In your package app.js file add

<your package>.aggregateAsset('js', '../<path_to_js_lib in "public/assets" folder>',{
    absolute: false
  });

Upvotes: 1

Related Questions