sequelize-docs-Zh-CN icon indicating copy to clipboard operation
sequelize-docs-Zh-CN copied to clipboard

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

Open PMBRK opened this issue 2 years ago • 0 comments

_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 avatar Aug 04 '22 11:08 PMBRK