This is the file im trying to apply on my app - route: utils/logger.vue
// utils/logger.vueimport Bun from 'bun';const file = Bun.file("foo.log");const writer = file.writer();export { writer };
// utils/logger.vueimport Bun from 'bun';const file = Bun.file("foo.log");const writer = file.writer();export { writer };
The code works, i do see the output in foo.log. However, after that the app crashes saying there is no module bun defined. This is every weird and cant find documentation on the problem
implementation:
// pages/index.vue<script setup lang="ts">const route = useRoute()import { writer } from '~/utils/logger'async function testWrite() { await writer.write("We are at the index app"); await writer.end(); // Don't forget to close the writer when done}testWrite();</script><template> <div> <h1>Nuxt Routing set up successfully!</h1> <p>Current route: {{ route.path }}</p> <a href="https://nuxt.com/docs/getting-started/routing" target="_blank">Learn more about Nuxt Routing</a> </div></template>
// pages/index.vue<script setup lang="ts">const route = useRoute()import { writer } from '~/utils/logger'async function testWrite() { await writer.write("We are at the index app"); await writer.end(); // Don't forget to close the writer when done}testWrite();</script><template> <div> <h1>Nuxt Routing set up successfully!</h1> <p>Current route: {{ route.path }}</p> <a href="https://nuxt.com/docs/getting-started/routing" target="_blank">Learn more about Nuxt Routing</a> </div></template>
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community