Select to view content in your preferred language

Seperate JS files

3408
12
Jump to solution
01-31-2018 06:43 AM
jaykapalczynski
Honored Contributor

I have an app that is starting to get a rather large amount of JS.

I was wondering if I could start to separate certain bits of code in a separate JS file and then just reference them.

If I reference it in HTML as I do the main JS file I get errors saying the map is not defined.

<script src="js/index.js"></script>
<script src="js/elevationprofile.js"></script>

Is there a way to reference all the split out JS files in the main JS file?

0 Kudos
12 Replies
KenBuja
MVP Esteemed Contributor

And you're calling dojo/_base/array twice in your code

0 Kudos
jaykapalczynski
Honored Contributor

I removed 

"dojo/_base/array"   and     array,

I kept 

"dojo/_base/array"   and    arrayUtils,

Still same error

0 Kudos
EvelynHernandez
Frequent Contributor

I asked this before and it might be useful for u.

https://community.esri.com/message/518589 

Right now im using a module bundler to help me on that...

0 Kudos