Sequelize with Sequelize-typescript decorators does not work after upgrading Vite from 2.4.4 to v2.5.1 #4727
Closed
7 tasks done
Labels
documentation
Improvements or additions to documentation
Describe the bug
After upgrading vite from 2.4.4 to 2.5.1, Sequelize (an ORM) will not properly hydrate objects retrieved from the database. This is while using
sequelize-typescript
, which is a package that allows to define ORM mappings using decorators/annotations, like so:As these decorators are kind of non-standard, my gut feeling is something changed here that causes sequelize to fail. However, looking at the generated source code (after turning minification off) there seems to be little change to how my code is compiled. Below shows main.js produced by vite without minification:
If the problem is not in the changes above, then the issue might be with compiling the sequelize/sequelize-typescript packages...
Reproduction
Use sequelize-typescript and build with Vite 2.5.1. Models will not hydrate.
Then, revert back to Vite 2.4.1 (
npm install [email protected]
). Verify that ESbuild is still the most recent version:Verify only vite was changed by looking at package-lock.json diff:
Build again, problem disappears!
my tsconfig.json:
Vite config:
Setting up a minimal test case is a bit of work, but please let me know if that's necessary, will be happy to provide a test case.
System Info
With Vite 2.4.4 (working):
With vite 2.5.1 (not working):
Used Package Manager
npm
Logs
Vite build works fine. The Sequelize symptoms show up in my application as follows as follows:
Notice in the above that the fields (e.g.
displayName
) areundefined
whereas Sequelize does manage to fetch the data (indataValues
) from the database.Validations
The text was updated successfully, but these errors were encountered: