I'd like to build my nextjs
project as development mode.
and I tried like it
package.json
{
...
"scripts": {
"dev": "next",
"build:dev": "set NODE_ENV=development & next build",
"build:prod": "set NODE_ENV=production & next build",
"start:dev": "set NODE_ENV=development & next start",
"start:prod": "set NODE_ENV=production & next start"
}
...
}
next.config.js
module.exports = withSass({
env: {
baseUrl: process.env.NODE_ENV === "development" ? "devServerURL": "prodServerURL"
}
});
but I couldn't achieve what I want.
so, I tried with some change.
package.json
"scripts": {
"dev": "next",
"build": "next build",
"start:dev": "set NODE_ENV=development & next start",
"start:prod": "set NODE_ENV=production & next start"
}
but it also doesn't work.
How can I build the next
with development mode?
Thanks in advance.
EDIT
My OS is Windows 10.
See issue #9123, (Oct 18, 2019) :
NODE_ENV is a reserved environment variable that cannot be changed. The only valid values are production, development, and test.
If you need your app behavior to change in different production environments, please use a different variable like APP_ENV.
And issues #17032 (Sep 12, 2020):
process.env.NODE_ENV
only has 2 possible valuesdevelopment
andproduction
. If this is not set to that value you'll run into all kinds of library edge cases (especially in node_modules) where you get severely de-optimized results. E.g. if you run a performance test you'll get significantly worse results ifprocess.env.NODE_ENV
is not set to production
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With