Search code examples
vue.jsbluebirdquasar-framework

Import bluebird on quasar


I am using bluebird.js and Quasar Framework. I would like to use it globally and previously configure it like

import { Promise } from 'bluebird';

Promise.config({
    cancellation: true });

But I'm not sure where to place it.


Solution

  • Looks like this is what Boot files were supposed for.

    // src/boot/promise.js
    export default () => {
      import { Promise } from 'bluebird';
    
      Promise.config({ cancellation: true });
    }
    
    // quasar.conf.js
    {
      boot: [ 'promise' ]
    }