Mongo TypeORM example don't work in production
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
If you test to start Mongo TypeORM example, with start:prod
command the console output this error :
[ExceptionHandler] Unexpected token import
/Users/robin/nestTest/examples/13-mongo-typeorm/src/photo/photo.entity.ts:1
(function (exports, require, module, __filename, __dirname) { import { Entity, Column, ObjectIdColumn, ObjectID } from 'typeorm';
^^^^^^
I’ve try to find a solution on the internet but without success 😕
Minimal reproduction of the problem with instructions
Pull https://github.com/nestjs/nest/tree/master/examples/13-mongo-typeorm
And run this commands :
npm install
npm run start:prod
Environment
Nest version: 4.5.0
For Tooling issues:
- Node version: v9.5.0
- Platform: Mac
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
TypeORM official relation example not working - Stack Overflow
TypeOrm doesn't seem to make it easy to handle relations automatically: ... are only supported in relational databases, they are not supported by...
Read more >SQL (TypeORM) | NestJS - A progressive Node.js framework
Warning In this article, you'll learn how to create a DatabaseModule based on the TypeORM package from scratch using custom providers mechanism.
Read more >DataSource API - typeorm - GitBook
mongoManager - MongoEntityManager used to work with entities for mongodb data source. For more information about MongoEntityManager see MongoDB documentation.
Read more >entity metadata not found typeorm - You.com | The AI Search ...
I am using NestJS with PostgreSQL and I had the same issue. The problem was by me is that I forgot to import...
Read more >db.collection.findOneAndUpdate() — MongoDB Manual
This is not the documentation for database commands or language-specific ... For example, if the update statement includes the identifier x (possibly ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fwoelffel @kamilmysliwiec exactly, but you can’t use the same
ormconfig.json
for developement and prodcution. So I created a config file for my environments and load it using theprocess.env.NODE_ENV
var.src/config.env.ts
:src/app.module.ts
:Note that TypeORM is looking for entities using the following path:
Production build is inside
dist
directory, notsrc
. In order to fix that you have to modifyormconfig.json
.