Is there a way to import a package for use in a Vuex Action only when the Action is dispatched, in order to reduce the size of my entry bundle?
Here's what I've tried:
export const actions = {
async createNewBin(store, bin) {
const firebase = require('firebase/app');
require('firebase/firestore');
const collectionRef = firebase.firestore().collection('bins');
try {
const docRef = await collectionRef.add(bin);
return docRef;
} catch (e) {
return e;
}
}
}
The firebase/firestore
package is currently included in my entry file, but I want to avoid that.