I used Adonis 5 in production, everytime I try npm run build
.env file didn't copy into the build folder, is it still a bug?
Asked
Active
Viewed 1,485 times
1

Felix gani harris
- 73
- 7
-
I have the same issue. I just opened a thread on Github https://github.com/adonisjs/core/discussions/1874 – Julien Le Coupanec Nov 07 '20 at 12:55
3 Answers
3
This is intentional since you are not supposed to use your development .env file in production.
This means that now, you have to run this command cp .env build/.env
before starting the process or it will not work.

Julien Le Coupanec
- 7,742
- 9
- 53
- 67
-
Thank u, yes I did it in my project, and it's work. But any updates for the released adonis 5 versions? hopefully, they can give a new update to make this more simple. – Felix gani harris Jul 13 '21 at 16:38
-
@Felixganiharris Adonis 5 is already released and stable. I am using it in production. – Julien Le Coupanec Jul 16 '21 at 13:34
3
you can modify the .adonisrc.json file in the "metaFiles" key
"metaFiles": [
".env",
".adonisrc.json",
{
"pattern": "public/**",
"reloadServer": false
},
{
"pattern": "resources/views/**/*.edge",
"reloadServer": false
}],
and then write the command node ace build

mohamed sharkawey
- 76
- 2
0
I've gone around it by using "postbuild": "@powershell copy '.env' 'build/.env'" when debugging on windows. Not the most elegant but it works to debug node.js typescript with adonisjs 5 on Visual Studio 2019.
-
-
1@XxXk5XxX This is an issue that can be circumvented by adding the .env file to the metaFiles node in adonissrc.json while you're working. Remember to remove it once you push – Antoine Azzopardi Mar 02 '21 at 15:20