Skip to content
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

_loadDialectModule require 一个变量在某些情况下加载不到 #77

Open
PMBRK opened this issue Aug 4, 2022 · 0 comments
Open
Labels

Comments

@PMBRK
Copy link

PMBRK commented Aug 4, 2022

_loadDialectModule(moduleName) {
try {
if (this.sequelize.config.dialectModulePath) {
return require(this.sequelize.config.dialectModulePath);
}
if (this.sequelize.config.dialectModule) {
return this.sequelize.config.dialectModule;
}
return require("sqlite3");
} catch (err) {
if (err.code === "MODULE_NOT_FOUND") {
if (this.sequelize.config.dialectModulePath) {
throw new Error(Unable to find dialect at ${this.sequelize.config.dialectModulePath});
}
throw new Error(Please install ${moduleName} package manually);
}
throw err;
}
}

return require("sqlite3"); 可以正常执行
return require(moduleName); 就会throw new Error(Please install ${moduleName} package manually)

@PMBRK PMBRK added the bug label Aug 4, 2022
@PMBRK PMBRK changed the title _loadDialectModule require 一个变量在某些情况下加载不了 _loadDialectModule require 一个变量在某些情况下加载不到 Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant