I am needing to pull in a value from my package.json file (the version of the application) and with t3 I am thrown the following error (see screenshot). This is being thrown in my
next.config.js
next.config.js
file which has the following code:
/** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */await import("./src/env.js");import { readFile } from "fs/promises";const packageJson = JSON.parse( await readFile(new URL("./package.json", import.meta.url), "utf-8"));/** @type {import("next").NextConfig} */const config = { reactStrictMode: true, publicRuntimeConfig: { version: packageJson.version, },};export default config;
/** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */await import("./src/env.js");import { readFile } from "fs/promises";const packageJson = JSON.parse( await readFile(new URL("./package.json", import.meta.url), "utf-8"));/** @type {import("next").NextConfig} */const config = { reactStrictMode: true, publicRuntimeConfig: { version: packageJson.version, },};export default config;