Open
Description
Figuring out how to conditionally load vue-axe was a bit tricky, but here's a working example for others who might want to use it on a typescrpt project. It's important to note that if you import VueAxe outside the if development conditional, it'll be added to vendors.js in production (it's huge).
let app = null;
const setupApp = (app: any) => {
mountWidgets(app, i18n);
app.use(store);
app.use(router);
app.use(i18n);
app.mount('#app');
};
if (process.env.NODE_ENV === 'development') {
import('vue-axe').then((res) =>{
const VueAxe = res.default;
const VueAxePopup = res.VueAxePopup;
app = createApp({
render: () => h(Fragment, [h(App), h(VueAxePopup)]),
});
app.use(VueAxe);
setupApp(app);
});
} else {
app = createApp(App);
setupApp(app);
}
Metadata
Metadata
Assignees
Labels
No labels