Wednesday, 31 May 2017

Understrap 'require is not defined'

I'm using the Understrap theme for my Wordpress project. I created a simple custom .js file to add to my project but I'm getting a 'require is not defined' error.

custom .js file

var express = require('express');
var moment = require('moment');
var app = express();
var m = moment();

app.get('/', function (req, res) {

     m.set({'year': 2017, 'month': 5, 'day': 29});
     //res.send(moment().format('YYYY/M/D'));
     var today = document.getElementById('today');
     today.innerHTML = moment().format('YYYY/M/D');
})



via input

No comments:

Post a Comment