# Object reference not set to an instance of an object - Importing Global Module

**URL:** <https://forums.fusetools.com/t/object-reference-not-set-to-an-instance-of-an-object-importing-global-module/2677>\
**Category:** Bug Reports\
**Created:** [September 1, 2016, 3:16am UTC](https://forums.fusetools.com/t/object-reference-not-set-to-an-instance-of-an-object-importing-global-module/2677 "2016-09-01T03:16:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Fall](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/david_fall/32/314_2.png) [@David\_Fall](https://forums.fusetools.com/u/David_Fall)\
**Post date:** [September 1, 2016, 3:16am UTC](https://forums.fusetools.com/t/object-reference-not-set-to-an-instance-of-an-object-importing-global-module/2677/1 "2016-09-01T03:16:40Z")

</div>

```auto
Unexpected fatal error! Please report this to us.
Fuse 0.24.0 (build 7243)
Build started: FullCompile
Configuring
fuse-components: E0000: Object reference not set to an instance of an object.
?: Error E0000: Object reference not set to an instance of an object.
C:\Users\509Dave16\Projects\Fuse\fuse-tic-tac-toe\app/MainView.ux(76): E8001: Data type not found: BorderedElement
C:\Users\509Dave16\Projects\Fuse\fuse-tic-tac-toe\app\MainView.ux(76,1): Error E8001: Data type not found: BorderedElement
C:\Users\509Dave16\Projects\Fuse\fuse-tic-tac-toe\app/MainView.ux(76): E8001: Could not resolve type 'BorderedElement'
C:\Users\509Dave16\Projects\Fuse\fuse-tic-tac-toe\app\MainView.ux(76,1): Error E8001: Could not resolve type 'BorderedElement'

Build completed in 2.94 seconds
    3 errors
Build ended
fuse: Failed to compile project

```

I received this error when attempting to import a JS module that was made globally available within an “included” fuse project. This JS Module is not related to ‘BorderedElement’ which is a ux:Class. I have a component called ObservableProxy. There is a .js file that defines the module. And a .ux file that makes it globally importable like so:

**ObservableProxy.ux**

```auto
<JavaScript File="ObservableProxy.js" ux:Global="DSF/ObservableProxy" />

```

**ObservableProxy.js**

```auto
var Observable = require("FuseJS/Observable");

function SetupProxy(debug) {
  if(debug) {
    printObjectMembers(Observable);
  }
}

function printObjectMembers(object) {
  for(var key in object) {
    console.log("Name of key:" + key);
    console.log("Type of key:" + typeof(object[key]));
  }
}

module.exports = function() {
  SetupProxy(true);
};

```

This component is in a sub project called fuse-components in the /vendor folder of the main project. And is included like so:

**fuse-tic-tac-toe.unoproj**

```auto
{
  "RootNamespace":"",
  "Packages": [
  	"Fuse",
  	"FuseJS"
  ],
  "Includes": [
    "app/**",
    "app/js/**.js:Bundle",
  ],
  "Projects": [
  	"vendor/fuse-components/fuse-components.unoproj"
  ]
}

```

I’m not sure why this is happening. Here’s a link to the Github project: [https://github.com/509dave16/fuse-tic-tac-toe](https://github.com/509dave16/fuse-tic-tac-toe)

Let me know if you need more details!

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [September 1, 2016, 7:34am UTC](https://forums.fusetools.com/t/object-reference-not-set-to-an-instance-of-an-object-importing-global-module/2677/2 "2016-09-01T07:34:51Z")

</div>

Hi!

Using `ux:Global` on `<JavaScript>` tags is a deprecated pattern. Instead, simply make sure your JS file is in the bundle of the included project, and then simply `require()` the file by a path relative to the project root.

That is, in your `fuse-component.unoproj`:

```
"Inculdes": [ 
   ...,
   "ObservableProxy.js:Bundle" 
]

```

And in your tic tac toe:

```
var op = require("ObservableProxy")
```
