1

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?

3 Answers3

3

From the founder of Adonis:

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
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

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.