Reputation: 2321
I would like to add a different app-links.json to the root of my project according to my NODE_ENV
I didn't see anything about adding a specific file to public
folder in nuxt-config.js
For example I want to have my app-links.json
at the root of my project to be
In production
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "...PRODUCTION...",
}
}]
And in staging
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "...STAGING...",
}
}]
Upvotes: 0
Views: 1814
Reputation: 46769
Explained something similar into one of my previous answers: https://stackoverflow.com/a/67689890/8816585
Use fs.writeFile
at the top of your nuxt.config.js
file to write a file depending of your env.
if (process.env.NODE_ENV === 'production') {
fs.writeFile(...production)
} else if (process.env.NODE_ENV === 'staging') {
fs.writeFile(...staging)
}
That way, every time you build your project, it will check the env variable related to your env and create the proper file.
You can try this locally with NODE_ENV=production yarn generate
(or NODE_ENV=production yarn build
in case your target is server
).
Upvotes: 1