Comments (2)
if we consider that you have two env: prod
and staging
. You can use dotenv and cross-env easily for that, but it has to be configured in next.config.js, and finally play in your packages.json
file
You must have 2 .env file prod and staging -> .env.prod
& .env.staging
Example of content of env.prod
BASE_URL="url-prod"
Example of content of env.stagnig
BASE_URL="url-staging"
And modify your next.config.js file, to handle the dynamic env load via the NODE_ENV
const { parsed: localEnv } = require('dotenv').config({
path: `./.env.${process.env.NODE_ENV}`
});
module.exports = {
env: {
BASE_URL: localEnv.BASE_URL,
},
// Other configurations
};
packages.json
"scripts": {
"build:staging": "cross-env NODE_ENV=staging nextron build --all",
"build:prod": "cross-env NODE_ENV=production nextron build --all",
"build:linux": "nextron build --linux --x64",
// Other scripts...
}
from nextron.
and of course use it as:
npm run build:staging
npm run build:prod
from nextron.
Related Issues (20)
- install directly with app router? HOT 2
- Command line arguments not working in dev command HOT 1
- Electron updater HOT 9
- ESM: latest sindresorhus packages support HOT 3
- IPC example HOT 14
- i18next Localization of dynamic pages does not work in the build HOT 2
- Nextron Tailwind Example does not work with `pnpm` HOT 2
- Vercel backend SSR / server actions HOT 1
- How to remove window.ipc.on listener? HOT 1
- cat not start debugger port
- error: unknown option '-o' HOT 16
- remote debugging HOT 1
- Nextron v9 with next js 14.2.4 white window in prod build with page router and electron 31 HOT 8
- Next Ui Support HOT 1
- vscode debug not work
- Is there an example of next js app router ? I tried ,but failed. HOT 3
- Monorepo: "Next not found in both dependencies and devDependencies."
- Nextron js is completely broken - Everything does not seems to work anymore HOT 3
- Nextron exports the build results to "app" directory, so please set "distDir" to "../app" in next.config.js HOT 1
- Using next js 14 app router,When nodeIntegration set to true,the useEffect not trigger,
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextron.