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

help needed for build checking #269

Open
sahandsn opened this issue Sep 20, 2024 · 4 comments
Open

help needed for build checking #269

sahandsn opened this issue Sep 20, 2024 · 4 comments

Comments

@sahandsn
Copy link

is there any more documentation/tutorials on how can i integrate unjs/jiti for checking env variables at build time with next.config.mjs?

@tiavina-mika
Copy link

+1

@tiavina-mika
Copy link

here is an example of how to use it
https://github.com/t3-oss/t3-env/tree/main/examples/nextjs

@Teekola
Copy link

Teekola commented Oct 2, 2024

It seems like using jiti with a higher version than in the example (1.21.0) will cause a webpack warning.

Next config file

// next.config.mjs

import createJiti from "jiti";
import { fileURLToPath } from "node:url";

const jiti = createJiti(fileURLToPath(import.meta.url));

// Import env here to validate during build. Using jiti we can import .ts files
jiti("./src/env/server");
jiti("./src/env/client");

Warning that is logged on both locale development and on Vercel. On locale development this is logged even on npm run dev, on Vercel this is during build.

<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /vercel/path0/node_modules/jiti/lib/jiti.mjs for build dependencies failed at 'import(id)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.

Switching to the older jiti version (1.21.0) made the warning disappear.

@kduprey
Copy link

kduprey commented Oct 5, 2024

Is there a way to resolve this warning with the latest version of jiti? Or would this be a defect of the t3-env library?

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

No branches or pull requests

4 participants