I have encountered an issue while attempting to import a JavaScript file into my Vue application, specifically in the main.js file. The console is displaying an error message stating
Uncaught ReferenceError: CI is not defined
.
The variable CI
exists inside Defines.js, which is a third party library that I am unable to modify. Here is the snippet of code from the main.js file:
main.js
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './afw/Utils/Defines.js' // <<< this line!
console.log(CI) // <<< I received an error at this line!
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
Due to the confidentiality of Defines.js, I can only provide a part of its script:
var CI = {};
...
if (typeof module !== 'undefined') {
module.exports = CI.Utils.Define;
}
I am seeking guidance on how to resolve this issue and make it work with VueJS 2. When I attempt to import other JavaScript files that rely on variables from Defines.js, I encounter the same problem:
import './afw/Utils/Defines'
import './afw/System/Core.js' // <<< Core.js requires a variable from Defines.js