I have some javascript to run in a blade file but it is waiting for a Vue component to fully load before running.
...
<p id="a"></p>
<my-vue-component></my-vue-component>
...
<script>
document.getElementById('a').innerText = 'ggg'
</script>
The javascript code waits for the Vue component to load and then it executes.
I don't want the Vue component pausing the rest of the javascript. I want it to load while the rest of the javascript executes or to load after the javascript finishes executing.
I tried installing the dynamic import plugin for async rendering
npm install --save-dev @babel/plugin-syntax-dynamic-import
and registering it in .babelrc
{
"plugins": ["@babel/plugin-syntax-dynamic-import"]
}
and running the compiler
npm run watch
And then in the app.js where the components are registered
Vue.component('my-vue-component', () => import('./components/MyVueComponent.vue').default);
That didn't do what I was expecting