Error including (require)

I have tried to include several stuffs and I get a JavaScript error at that line.
For instance, including any of the following

var Camera = require('FuseJS/Camera');
var ImageTools = require('FuseJS/ImageTools');

and several other packages.

Could it be an issue with my filing system or config file…

//Project file
{
  "RootNamespace": "",
  "Packages": [
    "Fuse",
    "FuseJS"
  ],
  "Includes": [
    "*",
    "Modules/*.js:Bundle"
  ],
}
//Filing System 
Assets/
Components/
Modules
Pages/
project.unoproj
MainView.ux

What error are you getting?

Module not found

Don’t forget to add a reference to the JS modules you’re using in your unoproj. In the camera docs, for example, it says:

You need to add a reference to "Fuse.Camera" in your project file to use this feature.

This means that you need to add "Fuse.Camera" under "Packages".

LOG: Error: JavaScript error in Pages/PostWallpaper.js line 3: Error message: Uncaught require(): module not found: FuseJS/ImageTools
File name: Pages/PostWallpaper.js
Line number: 3
Source line: var ImageTools = require(‘FuseJS/ImageTools’);
in Fuse.Reactive.JavaScript</Users/quincykwende/Library/Application Support/Fusetools/Packages/Fuse.Reactive/0.45.5/$.uno:1670>

Then do the same for the ImageTools module. :slight_smile:

Thanks for the updates. How do I add the reference

Olle Fredriksson wrote:

Don’t forget to add a reference to the packages you’re using. In the camera docs, for example, it says:

You need to add a reference to "Fuse.Camera" in your project file to use this feature.

This means that you need to add "Fuse.Camera" under "Packages".

You literally add the items to the list that comes after "Packages": in the Uno project file you pasted above. Your new unoproj might look like this:

//Project file
{
  "RootNamespace": "",
  "Packages": [
    "Fuse",
    "FuseJS",
    "Fuse.Camera",
    "Fuse.ImageTools"
  ],
  "Includes": [
    "*",
    "Modules/*.js:Bundle"
  ],
}

Also see the relevant section in the unoproj docs.

Thanks I did that and it didn’t work. That’s why i asked.

It works now. I had to restart the app.

Thanks a million