-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth module strictly depends on Lucid #236
Comments
I would suggest trying something like this : // utils.ts
export function isModuleInstalled(moduleName: string) {
const require = createRequire(import.meta.url)
try {
require.resolve(moduleName)
return true
} catch (error) {
return false
}
}
// index.ts of @adonisjs/auth
let withAuthFindder
if (isModuleInstalled('@adonisjs/lucid')) {
withAuthFinder = await import('./with_auth_finder')
}
export { withAuthFinder } this should work fine |
Can't use |
Should we implement the suggestion shared by @Julien-R44 or have a breaking change release that moves the import to a sub-module? import { withAuthFinder } from '@adonisjs/auth/mixins' |
It feels better to have the However, we keep in mind that this needs to be done in the next major release. |
i agree a breaking change just for that would be a bit annoying I would say :
so people can migrate in peace |
Ohh yeah, deprecation + new export will be the best |
@RomainLanz Can you do a PR for it and at the same time update docs to use new import path, so that atleast new apps are using the submodule. |
In case anyone comes here later, assuming you are using lucid, to adopt this change simply update
|
Hey there! 👋🏻
The
@adonisj/auth
module strictly depends on@adonisjs/lucid
since we added thewithAuthFinder
mixins.The mixin imports a Lucid decorator at its root:
Since we are exporting the mixin from the root of the package, we strictly depend on it and cannot use the Auth module without installing Lucid.
We must find a way to remove this hard dependency without adding any breaking change to the current API.
The text was updated successfully, but these errors were encountered: