I currently have a massive node JS file (3100+ line of code) and I am trying to split it up into multiple files. I have taken one of the functions and a bunch of firebase database references and put them into their own file inside their own class. For some reason the Firebase references give me an error no matter what even when the syntax seams to be okay:
/.../lib/context.js:13
static database = firebase.database()
^
SyntaxError: Unexpected token =
Here is my code for importing the file
// index.js
'use strict'
var ... = ...()
...
var util = require('util')
var fs = require('fs')
var http = require('http')
var firebase = require('firebase')
var Context = require('./lib/context.js')
and here is my code of the imported file:
'use strict'
var util = require('util')
var firebase = require('firebase')
exports.Context = class
{
constructor()
{
}
static database = firebase.database()
static homeworkRef = database.ref("/homework")
static usersRef = database.ref("/users")
static announcementsRef = database.ref("/announcements")
static votingRef = database.ref("/voting")
static feedbackRef = database.ref("/feedback")
static peerRef = database.ref("/peer_review")
Am I requiring the file correctly? Why does this error keep happening? It worked fine while it was in one file.