LE
leimonio/use-nextjs-module-config
This is a repository for reproducing an issue with Next.js when using next module.
This is a repository for reproducing an issue with latest Next.js v13.5.
When using Next.js as an imported module import next from "next"; and running the dev server with providing a configuration object, the configuration object is not respected.
import next from "next";
// ...
// ...
next({
dev: true,
dir: nextRoot,
conf: {
env: {
customKey: "my-value",
},
},
});Folder structure
next-root- a Next.js app using App Routernext-root-pages- a Next.js app using Pages Routerscirpts/next-run.mjs- the runner usingnextmodule
How to reproduce the issue
- Clone the repo
- Run
npm run dev:custom- running the dev server fornext-root
Alternatively, runnpm run dev:custom:pages- running the dev server fornext-root-pages - Open browser at
localhost:9988 - Observe
The value of customKey is:string is empty without containing any env key. - Uncomment the
envconfiguration fromnext.config.jsand rerun the command in step 2. - Observe
The value of customKey is: my-valuestring is printing the env keymy-value.
On this page
Languages
JavaScript92.8%CSS3.9%TypeScript3.3%
Contributors
Created October 4, 2023
Updated October 4, 2023