Assuming you are using ES6 and a kit like Webpack, you can start using Fabric.js as follows:
At the command line:
npm add fabric (or yarn add fabric )
Then import it into a .js file.
import { fabric } from 'fabric'
Then configure the Canvas method in Vue mounted:
Note. For me, by default, the fabric npm module led to a rather large package. I ended up using the fabric-browseronly . Fabric.js has many features that you might not need, in which case you can create your own version here or through the command line.
source share