# Include JS files recursively

**URL:** <https://forums.fusetools.com/t/include-js-files-recursively/5761>\
**Category:** How-to Discussions\
**Created:** [June 23, 2016, 10:38am UTC](https://forums.fusetools.com/t/include-js-files-recursively/5761 "2016-06-23T10:38:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vicker\_Leung](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/vicker_leung/32/392_2.png) [@Vicker\_Leung](https://forums.fusetools.com/u/Vicker_Leung)\
**Post date:** [June 23, 2016, 10:38am UTC](https://forums.fusetools.com/t/include-js-files-recursively/5761/1 "2016-06-23T10:38:13Z")

</div>

Hi, I would like to know how to include JS files recursively.

```auto
root
/src/module_a/x.js
/src/module_b/y.js
/src/module_c/z.js

```

I tried to use `**` in `.unoproj` but it creates a weird Uno error.

```auto
"Includes":[
 "*",
 "src/**/*.js:Bundle"
 ]

```

The only workaround is like this but kind of stupid.

```auto
"Includes":[
 "*",
 "src/module_a/*.js:Bundle",
 "src/module_b/*.js:Bundle",
 "src/module_c/*.js:Bundle"
 ]

```

---

<div class="post-metadata">

**Author:** ![Anders\_Bondehagen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_bondehagen/32/98_2.png) [@Anders\_Bondehagen](https://forums.fusetools.com/u/Anders_Bondehagen)\
**Post date:** [June 23, 2016, 1:14pm UTC](https://forums.fusetools.com/t/include-js-files-recursively/5761/2 "2016-06-23T13:14:59Z")

</div>

That sounds like a bug. Does `"src/**.js:Bundle"` work as a workaround?

---

<div class="post-metadata">

**Author:** ![Morten\_Daniel\_Fornes](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/morten_daniel_fornes/32/52_2.png) [@Morten\_Daniel\_Fornes](https://forums.fusetools.com/u/Morten_Daniel_Fornes)\
**Post date:** [June 23, 2016, 5:20pm UTC](https://forums.fusetools.com/t/include-js-files-recursively/5761/3 "2016-06-23T17:20:43Z")

</div>

Hi,

Removing the file extension will bundle all files recursively.

```auto
"Includes": [
  "src/**:Bundle"
]

```

Any unwanted files can be excluded using the `Excludes` property.

Hope it helps.

---

<div class="post-metadata">

**Author:** ![Vicker\_Leung](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/vicker_leung/32/392_2.png) [@Vicker\_Leung](https://forums.fusetools.com/u/Vicker_Leung)\
**Post date:** [June 24, 2016, 2:58am UTC](https://forums.fusetools.com/t/include-js-files-recursively/5761/4 "2016-06-24T02:58:11Z")

</div>

Thanks, Anders.

`src/**.js:Bundle` doesn’t work. Fuse will return JavaScript error Fuse.Scripting.Error: require(): module not found.

Thanks, Morten.

`src/**:Bundle` results a compilation error with things that are unrelated.

```auto
E8001: Data type not found: VSplashScreen
E8001: Could not resolve type 'VSplashScreen'

```

src/splash\_screen/views/VSplashScreen.ux

```auto
<Panel ux:Class="VSplashScreen">
    ...
</Panel>

```

---

<div class="post-metadata">

**Author:** ![Morten\_Daniel\_Fornes](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/morten_daniel_fornes/32/52_2.png) [@Morten\_Daniel\_Fornes](https://forums.fusetools.com/u/Morten_Daniel_Fornes)\
**Post date:** [June 24, 2016, 9:54am UTC](https://forums.fusetools.com/t/include-js-files-recursively/5761/5 "2016-06-24T09:54:05Z")

</div>

When you use a typed recursive pattern it’ll override default file types, so your UX aren’t compiled anymore, just bundled.

```auto
"Includes": [
  "*",
  "*.uno:Source",
  "*.ux:UX",
  "src/**:Bundle"
]

```

This is explicitly setting file type on _.uno and_ .ux files before adding everything else as “Bundle”.

If you organize your run-time files in a different subdirectory (“js”) than your compile-time files (“src”) you can get away with a cleaner project.

```auto
"Includes": [
  "*",
  "js/**:Bundle"
]

```

---

<div class="post-metadata">

**Author:** ![Vicker\_Leung](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/vicker_leung/32/392_2.png) [@Vicker\_Leung](https://forums.fusetools.com/u/Vicker_Leung)\
**Post date:** [June 28, 2016, 4:30am UTC](https://forums.fusetools.com/t/include-js-files-recursively/5761/6 "2016-06-28T04:30:18Z")

</div>

Thanks Morten.

Indeed organizing files under js is a possible option. But for crazily large projects, having different modules as a base folder do have it’s advantages. e.g. being able to a quick view of what’s available within a particular module.

```auto
src/module_a/components/component_x.ux
src/module_a/views/view_x.ux
src/module_a/controllers/controller_x.js
src/module_a/delegates/delegate_x.js
src/module_a/models/model_x.js
src/module_a/data/data_x.js
src/module_a/assets/image_x.png

src/module_b/components/component_x.ux
src/module_b/views/view_x.ux
src/module_b/controllers/controller_x.js
src/module_b/delegates/delegate_x.js
src/module_b/models/model_x.js

```

Hopefully an include syntax like this will be possible in the future.

```auto
"Includes": [
  "*",
  "src/**/*.js:Bundle",
  "src/**/*.png:Bundle"
]

```
