-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
Custom drivers failed on build #2096
Comments
I have the same problem with a custom driver: ` ERROR Couldn't load driver /Users/vogel/Entwicklung/Workspace/ypsystems/brock/rcp-ui-web/src/drivers/payload/driver.mjs 12:08:44 ERROR Cannot read properties of undefined (reading 'getKeys') ` and using the following nuxt.config: ` sources: [ Does anybody know to resolve this issue? |
I am getting the same error while building with custom webdav driver:
|
We need to modify the export function getMountDriver (mount: MountOptions) {
const dirverName = mount.driver as keyof typeof unstorageDrivers
if (unstorageDrivers[dirverName]) {
return unstorageDrivers[dirverName](mount as any)
}
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
return require(mount.driver).default(mount as any)
} catch (e) {
// eslint-disable-next-line no-console
console.error("Couldn't load driver", mount.driver)
}
} We need to make async function getMountDriver(mount) {
const dirverName = mount.driver;
if (unstorageDrivers[dirverName]) {
return unstorageDrivers[dirverName](mount);
}
try {
return (await import(mount.driver)).default(mount) //require(mount.driver).default(mount);
} catch (e) {
console.error("Couldn't load driver", mount.driver);
}
} And await the function at this block of the for (const [key, source] of Object.entries(sources)) {
storage.mount(key, await getMountDriver(source));
} |
Also it appears to be necessary to add to "compilerOptions": {
"lib": [ "es2015" ]
}, to avoid Typescript error |
Submitted PR to resolve issue. |
Environment
Reproduction
The full source is here
Describe the bug
Hey,
I've an issue, I'm trying to implement a custom drivers.
Everything work fine on development but
npm run build
failed this error:diging the stacktrace, here is the orginal error from here
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: