# How to include a vendor multi-module JS library in Rails?

**URL:** <https://www.ruby-forum.com/t/how-to-include-a-vendor-multi-module-js-library-in-rails/231756>\
**Category:** Rails\
**Created:** [August 28, 2014, 10:04am UTC](https://www.ruby-forum.com/t/how-to-include-a-vendor-multi-module-js-library-in-rails/231756 "2014-08-28T10:04:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 28, 2014, 10:04am UTC](https://www.ruby-forum.com/t/how-to-include-a-vendor-multi-module-js-library-in-rails/231756/1 "2014-08-28T10:04:38Z")

</div>

Hello everyone,

I am trying to include a JS library (GeoExt  
[https://geoext.github.io/geoext2/](https://geoext.github.io/geoext2/)) in an existing Rails application.  
Following the Asset Pipeline guide  
[http://guides.rubyonrails.org/asset\_pipeline.html](http://guides.rubyonrails.org/asset_pipeline.html), I did:

- 

## Created the folder /vendor/assets/javascripts/GeoExt to where I copied all the JS modules.

## Created the file /vendor/assets/javascripts/GeoExt/index.js containing the //= require\_tree . directive.

In the application.js file included the directive //= require GeoExt.

With this setting I am getting a 404 error every time a module from this  
library is referenced. What am I doing wrong?

Thank you.

---

<div class="post-metadata">

**Author:** ![apicito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@apicito](https://www.ruby-forum.com/u/apicito)\
**Post date:** [August 28, 2014, 10:24am UTC](https://www.ruby-forum.com/t/how-to-include-a-vendor-multi-module-js-library-in-rails/231756/2 "2014-08-28T10:24:06Z")

</div>

On 28 August 2014 09:03, Luís de Sousa [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> In the application.js file included the directive //= require GeoExt.
> 
> With this setting I am getting a 404 error every time a module from this  
> library is referenced. What am I doing wrong?

I have not done exactly that. Does it work if you put GeoExt  
immediately under assets so /vendor/assets/GeoExt?

Colin

---

<div class="post-metadata">

**Author:** ![apicito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@apicito](https://www.ruby-forum.com/u/apicito)\
**Post date:** [August 28, 2014, 2:01pm UTC](https://www.ruby-forum.com/t/how-to-include-a-vendor-multi-module-js-library-in-rails/231756/3 "2014-08-28T14:01:19Z")

</div>

You probably have same problem that I was writing in this post.  
[https://www.ruby-forum.com/topic/5503104](https://www.ruby-forum.com/topic/5503104)

Javascript library is trying to load modules in runtime. Your chance is  
to place javascript files directly to the place (url) where they are  
required. Look at the url in error and put javascript files there.

by  
TheR

---

<div class="post-metadata">

**Author:** ![apicito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@apicito](https://www.ruby-forum.com/u/apicito)\
**Post date:** [September 2, 2014, 2:40pm UTC](https://www.ruby-forum.com/t/how-to-include-a-vendor-multi-module-js-library-in-rails/231756/4 "2014-09-02T14:40:36Z")

</div>

Hi Colin,

No, moving the library a folder up doesn’t not change the outcome.

Thank you,

Luís

---

<div class="post-metadata">

**Author:** ![apicito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@apicito](https://www.ruby-forum.com/u/apicito)\
**Post date:** [September 2, 2014, 2:47pm UTC](https://www.ruby-forum.com/t/how-to-include-a-vendor-multi-module-js-library-in-rails/231756/5 "2014-09-02T14:47:55Z")

</div>

Hi Damjan,

These URLs are point to /datasets/mass\_import, a path that does not  
exist  
in this project:

[http://localhost:3000/datasets/mass\_import/GeoExt/data/reader/Wmc.js?\_dc=1409661484402](http://localhost:3000/datasets/mass_import/GeoExt/data/reader/Wmc.js?_dc=1409661484402)

If you are correct, then I a do not have much of an idea where to  
include  
the library.

Thank you,

Luís
