Skip to content

Commit

Permalink
fix: defineNitroPlugin is undefined after build in nitro.mjs (#94)
Browse files Browse the repository at this point in the history
Fixes issue with defineNitroPlugin being undefined when running `nuxi preview` in nuxt 4.
```
.output/server/chunks/nitro/nitro.mjs:13178
const _FAcPlHCrZY = defineNitroPlugin((nitro) => {
                    ^
ReferenceError: defineNitroPlugin is not defined
    at file:///.output/server/chunks/nitro/nitro.mjs:13178:21
```
  • Loading branch information
jbjorge authored Dec 29, 2024
1 parent cd6d3a8 commit 2374647
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default defineNuxtModule<ModuleOptions>({
write: true,
getContents() {
return `
import { defineNitroPlugin } from '#imports'
import { createCronHandler } from '${resolve('./runtime/server')}'
${files.map((file, index) => `import cronJob${index} from '${file.replace('.ts', '')}'`).join('\n')}
Expand Down

0 comments on commit 2374647

Please sign in to comment.