Closed agracia-foticos closed 2 months ago
We haven't encountered such an issue, could you please provide more information or create a reproduction? Having at least nuxt.config.ts
would help
Hello 👋
Please provide a reproduction for this issue 🙏
https://stackblitz.com/edit/nuxt-starter-irb91s
This is an example. In this reproduction i put the module.
My project implements this module in nuxt.config.ts modules : ['nuxt-sso']
Hi @agracia-foticos , I checked your reproduction and I think the problem is actually in the addServerScanDir
in your module.ts
which seems to just transpile TypeScript to JS and nothing else.
You can look at the code produced by it in the dist
folder inside your reproduction if you run npm run prepack && npm run dev
. The code is simply transpiled, snippet:
// dist/runtime/server/api/auth/[...].js
import { NuxtAuthHandler } from "#auth";
export default NuxtAuthHandler({
secret: useRuntimeConfig().authSecret,
providers: [
It is very easy to verify that nuxt-auth
is not a culprit by simply doing this in your [...].ts
:
// import { NuxtAuthHandler } from '#auth';
function NuxtAuthHandler(config) {
console.log(config);
}
export default NuxtAuthHandler({
secret: useRuntimeConfig().authSecret,
providers: [
In this case you get a different error:
[nuxt] [request error] [unhandled] [500] useRuntimeConfig is not defined
And it is obvious that auto-imports were not injected and no usual "Nuxt magic" happened.
I would recommend you to approach the unjs/nitro
team with the reproduction which is almost good already. I had to adjust your module.ts
to make it work
baseURL: `${process.env.NUXT_BASE_URL ?? ''}/api/auth`
I couldn't find addServerScanDir
in the Nitro web documentation and haven't looked into their source code.
There are also Nuxt Layers which seem to accomplish a similar thing as your meta-module.
Hi @agracia-foticos 👋
I have tested this issue in a couple of new projects and do belive the issue is the one outlined above by @phoenix-ru. I will close this issue, as we have not heard from you in a while. If the issue persists feel free to re-open the issue!
Environment
Linux
v20.5.1
3.12.3
3.12.0
2.9.7
yarn@4.3.1
-
devtools
,ssr
,css
,extends
,modules
,runtimeConfig
@wpx/auth-internal
-
Reproduction
If i compile with npm run dev throws this error
ERROR [nuxt] [request error] [unhandled] [500] Package import specifier "#auth" is not defined in package /home/foticos/var/www/wpx/packages/auth-internal/package.json imported from /home/foticos/var/www/wpx/packages/auth-internal/dist/runtime/server/api/auth/[...].js
with npx nuxi build and start server not fails
Describe the bug
If i compile with npm run dev throws this error
ERROR [nuxt] [request error] [unhandled] [500] Package import specifier "#auth" is not defined in package /home/foticos/var/www/wpx/packages/auth-internal/package.json imported from /home/foticos/var/www/wpx/packages/auth-internal/dist/runtime/server/api/auth/[...].js
with npx nuxi build and start server not fails
Additional context
No response
Logs
No response