We currently have some Javascript that used to work, however we recently underwent a system upgrade, and we are doing some regression testing.
Now our script is not recognizing our function anymore:
Uncaught ReferenceError: autocomplete is not defined
However, it seems like the issue is related to how the function is defined, and my JS is unfortunately very basic.
Our declaration is:
<script type="text/javascript">
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.autocomplete = factory());
}
(this, function () { 'use strict';
/*
* https://github.com/kraaden/autocomplete
* Copyright (c) 2016 Denys Krasnoshchok
* MIT License
*/
function autocomplete(settings) {
Any assistance or guidance would be greatly appreciated. Thanks in advance.
Edit: Just an additional error received when other JS on the page executes:
Uncaught Error: Mismatched anonymous define() module: function () { 'use strict';
Turns out the new upgrade uses a different requirejs library.
We reverted to the old library, and our code is now working.
(we will investigate and resolve the code dependency at a later point, so that the new library can be used.)