Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nextjs Edge runtime #11

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BowlingX
Copy link
Contributor

This is just a rough draft.

I think a better approach would be to use the export map to import different implementation.
e.g.

import { parseEnv } from "znv/node";
import { parseEnv } from "znv/next-edge";

The default could just point to the node implementation (to make it backwards compatible).
The easiest would possibly to make parseEnv a factory that allows to pass the reportErrors function.

"extensionsToTreatAsEsm": [
".ts"
],
"rootDir": "src",
"transform": {
"^.+\\.cts$": [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I had to add babel here is that ts-jest does not support the cts extension.
See kulshekhar/ts-jest#3996

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now it's clumsy and I think not all runtimes can be detected properly, so it's better to just use export maps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant