Closed canccevik closed 1 year ago
Hey,
Thanks for posting this!
I think we can probably change the range on the peer dependency for @nestjs/common. Are you up for opening a PR for that?
I apologize, but I didn't quite understand. The latest version of this package already supports @nestjs/common v10
as peer dependency, but it doesn't support ES modules. If there was any branch for v1.0.0
, i couldn't see it either. What exactly and how should I open the PR for?
Do you mean you're using CommonJS? I can create a v1 branch, but if you're using ESM, I suggest updating to v2
I'm already using ESM and i already have installed nestjs-envalid@2.2.0
but i am getting the following error:
const nestjs_envalid_1 = require("nestjs-envalid");
Error [ERR_REQUIRE_ESM]: require() of ES Module
If you are using ESM, you shouldn't be using require
. Let me find a guide for you :)
@canccevik If you're still having issues, maybe you could create a repro so it's easier to understand the issue? :)
Here is the repo: https://github.com/canccevik/nestjs-starter-template
When i run the command npm start
, i am getting the error that i mentioned in my previous comment. For instance, when i am using nest-typed-config, i don't get any errors, and I don't have to change the module
option in my tsconfig file or the type
option in the package.json file to module
. All i want is just using this package directly without changing tsconfig or package.json like in v1.0.0
. I wish you type "@nestjs/common": ">=7"
in here 😄
Okay, if you don't want to use to ESM module (setting "type": "module"
in package.json
) we need to cut a new release for v1. As I said before, I think we should keep maintaining v1 for a while, so that's fine. Opening a v1
branch now 🛎️
Hello!
v1
branch is now available, all relevant commits from v2 are cherry-picked over and a new release bringing support up to nestjs v10 is release in v1.3.0 also available in NPM by installing using legacy
tag:
yarn add nestjs-envalid@legacy
See NPM for more: https://www.npmjs.com/package/nestjs-envalid
I hope this helps! Closing this for now, but let me know if there is anything else!
Note: I recommend starting to use ESM soon (where "type": "module"
is set in package.json
), as nestjs-envalid
will at some point stop supporting CommonJS. This will likely happen to many packages as time passes, i.e. all the packages from sindresorhus are already migrated to ESM. Worst case: You'll get stuck not getting security updates.
I updated README now to reflect these things better. Let me know if you have some feedback! 🙌
The informative section about this issue in readme file looks perfect to me! Thank you very much for taking your time to solve my problem :)
Read also #53 for more :)
Hi,
I am currently using ES modules in my project. As I can see from #19, you recommend using version
1.0.0
when working with ES modules. However, when I try to use version1.0.0
with@nestjs/common v10.1.2
, i am getting the following error:npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/common@">=7 <=8" from nestjs-envalid@1.2.1
npm ERR! node_modules/nestjs-envalid
npm ERR! nestjs-envalid@"^1.0.0" from the root project
How can i use version
1.0.0
without downgrade the version of@nestjs/common
to between 7 and 8?