Hi, I would like to know how to include JS files recursively.
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.
"Includes":[
"*",
"src/**/*.js:Bundle"
]
The only workaround is like this but kind of stupid.
"Includes":[
"*",
"src/module_a/*.js:Bundle",
"src/module_b/*.js:Bundle",
"src/module_c/*.js:Bundle"
]
That sounds like a bug. Does "src/**.js:Bundle"
work as a workaround?
Hi,
Removing the file extension will bundle all files recursively.
"Includes": [
"src/**:Bundle"
]
Any unwanted files can be excluded using the Excludes
property.
Hope it helps.
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.
E8001: Data type not found: VSplashScreen
E8001: Could not resolve type 'VSplashScreen'
src/splash_screen/views/VSplashScreen.ux
<Panel ux:Class="VSplashScreen">
...
</Panel>
When you use a typed recursive pattern it’ll override default file types, so your UX aren’t compiled anymore, just bundled.
"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.
"Includes": [
"*",
"js/**:Bundle"
]
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.
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.
"Includes": [
"*",
"src/**/*.js:Bundle",
"src/**/*.png:Bundle"
]