Hi,
I am having issue when using the envfile plugin.
All works fine, esbuild is also successful, post-build env variables are also working.
Now issue arises when we try to start the nodejs server locally.
nodemon local.ts
import * as env from "env";
Error: Cannot find module 'env'
Require stack:
- D:\physioSurge\physioSurge_backend\controllers\authenticationController.ts
- D:\physioSurge\physioSurge_backend\routes\authentication-routes.ts
- D:\physioSurge\physioSurge_backend\server.ts
- D:\physioSurge\physioSurge_backend\local.ts
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\ts-node\node_modules@cspotcode\source-map-support\source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (D:\physioSurge\physioSurge_backend\controllers\authenticationController.ts:15:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module.m._compile (C:\Users\Administrator\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1597:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions. [as .ts] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1600:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\physioSurge\physioSurge_backend\controllers\authenticationController.ts',
'D:\physioSurge\physioSurge_backend\routes\authentication-routes.ts',
'D:\physioSurge\physioSurge_backend\server.ts',
'D:\physioSurge\physioSurge_backend\local.ts'
]
}
This is my tsconfig.json file
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"sourceMap": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"lib": ["ES2020"],
"module": "CommonJS",
"resolveJsonModule": true,
"moduleResolution": "node",
"noImplicitAny": false,
"outDir": "dist",
"removeComments": true,
"skipLibCheck": true,
"strict": false,
"strictNullChecks": false,
"target": "ES2020",
"typeRoots": ["node_modules/@types", "types"],
"types": ["node"],
"paths": {
"env": ["types/environment.d.ts"] // this mapping is relative to "baseUrl"
}
},
"include": ["/*.ts", "/.d.ts"],
"exclude": ["dist/", "node_modules"],
"defaultSeverity": "warning"
}