Skip to content

Commit

Permalink
Merge pull request #46 from prisma/DA-1375
Browse files Browse the repository at this point in the history
fix: add auto-import for prisma component on the server
  • Loading branch information
mhessdev authored Nov 2, 2024
2 parents 3ef8c5e + bcf1e52 commit 6b9b48a
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 6b9b48a

Please sign in to comment.