I have a component that is embedded within a page in my Nuxt project.
This particular component contains the following lifecycle hooks:
<script>
export default {
name: 'MyComponent',
created() { alert('hello there!') },
mounted() { alert('hello again!') }
}
</script>
While this functions correctly in development mode, I encountered an issue when exporting the site as fully static using "nuxt generate." The code within the created and mounted hooks fails to execute, resulting in the alerts not appearing upon loading the page.
I am puzzled by what seems like a simple oversight on my part. Are the created/mounted lifecycle hooks invoked for components in full static Nuxt sites? If not, what is the best practice for initializing the code responsible for managing a component?