Skip to content

Commit

Permalink
fix: add auto-import for prisma component on the server
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch committed Oct 29, 2024
1 parent bc1f4be commit bcf1e52
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
23 changes: 11 additions & 12 deletions playground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
"postinstall": "nuxi prepare"
},
"devDependencies": {
"@prisma/client": "^5.21.1",
"nuxt": "^3.11.2",
"prettier": "3.2.5",
"prisma": "^5.15.0"
},
"dependencies": {
"@prisma/client": "^5.15.0"
}
}
6 changes: 6 additions & 0 deletions playground/server/api/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default defineEventHandler(async (event) => {
const firstUser = await prisma.user.findFirst();
return {
firstPost: firstUser,
};
});
1 change: 1 addition & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default defineNuxtModule<PrismaExtendedModule>({

// Auto-import from runtime/server/utils
addServerImportsDir(resolver(runtimeDir, "utils"));
addServerImportsDir(resolver(runtimeDir, "server/utils"));

nuxt.options.vite.optimizeDeps ||= {};
nuxt.options.vite.optimizeDeps = {
Expand Down

0 comments on commit bcf1e52

Please sign in to comment.