I wanna import a package to use it inside a Vuex Action but only when the Action is dispatched in order to save on my entry bundle size.
My attempt on the solution:
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 is inside my entry file and I do not want that.
from Load a Package inside a Vuex Action only when it is dispatched
No comments:
Post a Comment