Dear Netlify Community,
please don’t apply .gitignore
rules to the publish directory!
I’m deploying a NuxtJS app in static mode. During build it will generate a
folder /dist
which can be uploaded to any static file hoster. Here’s my
configuration:
Repository: github.com/Schaeferjo/werkhof-ichen
Base directory: frontend
Build command: yarn run generate
Publish directory: frontend/dist
During build, Netlify would basically do the following:
cd frontend
yarn install
yarn run generate
It would then upload the generated folder frontend/dist
.
I previous deployments I could see that a particular file was missing: /sw.js
After I changed this line in my .gitignore
:
sw.*
To this line:
static/sw.*
The file was suddenly being uploaded during deployment!
Here’s the commit: ci: Temporarily test netlify's upload behaviour · Schaeferjo/werkhof-ichen@b0a79a1 · GitHub
I can see what’s going on here but this behaviour doesn’t make any sense. The folder /dist
is already in my .gitignore
. I don’t want this folder to be in version control, that’s why it’s git-ignored. During deployment, I want it to be uploaded, why do you even apply .gitignore
rules here?
Besides that, please document this behaviour!
On another occasion I had a hard time figuring out that a local deployment via Netlify CLI behaves differently compared to a remote deployment of Netlify. In this case, any **/node_modules/
would not be uploaded, even if this folder was in the dist/
directory under _nuxt/something/node_modules/
as it contained my application code required during runtime.
Hope these observations may help some other developers!
Cheers,
Robert