windyScripts / dev-directory

21 stars 5 forks source link

conditionally import dev router #92

Closed timmyichen closed 1 year ago

timmyichen commented 1 year ago

Description

The dev router was importing some dev-only dependencies that were used in the test utils. This was the error in the heroku logs for staging:

2023-04-30T23:15:59.930969+00:00 heroku[web.1]: Starting process with command `node dist/server/index`
2023-04-30T23:16:01.396176+00:00 app[web.1]: node:internal/modules/cjs/loader:1078
2023-04-30T23:16:01.396200+00:00 app[web.1]:   throw err;
2023-04-30T23:16:01.396201+00:00 app[web.1]:   ^
2023-04-30T23:16:01.396201+00:00 app[web.1]: 
2023-04-30T23:16:01.396201+00:00 app[web.1]: Error: Cannot find module '@ngneat/falso'
2023-04-30T23:16:01.396201+00:00 app[web.1]: Require stack:
2023-04-30T23:16:01.396201+00:00 app[web.1]: - /app/dist/server/test/utils.js
2023-04-30T23:16:01.396202+00:00 app[web.1]: - /app/dist/server/api/dev/dev.controller.js
2023-04-30T23:16:01.396202+00:00 app[web.1]: - /app/dist/server/api/dev/index.js
2023-04-30T23:16:01.396202+00:00 app[web.1]: - /app/dist/server/api/index.js
2023-04-30T23:16:01.396202+00:00 app[web.1]: - /app/dist/server/server.js
2023-04-30T23:16:01.396203+00:00 app[web.1]: - /app/dist/server/index.js

This change makes the dev router dynamically imported only if it's going to be used.

Testing

N/A

Type of change

Please remove all except for everything applicable, and then remove this line.

Checklist: