I have developed JS classes that I want to import into the app.js or main.js file of my vue.js project, so that I can create instances of them in various components. Currently, I find myself having to import the same JS class separately in all components where it is needed.
Although I attempted to import the class in the main.js file, the components are unable to recognize it.
In the main.js file, my import statement looks like this:
import Permissions from './Permissions'
However, when trying to instantiate the Permissions class within a component using:
data() {
permissions: new Permission({
// some object properties...
})
}
The component does not recognize what Permissions
is.
How can I make sure the component knows what the Permissions
class is?