I have an 11ty site and I’m using netlify dev
locally to serve/preview it. I have installed the debug
package (debug - npm) in my 11ty site. When I use netlify dev
to serve the project, I don’t see the debug messages on the console. I think this used to work, but frankly, I can’t remember.
When I do this, I see the debug messages on my console:
$ DEBUG=Eleventy* npm run start
When I do this, I don’t see the debug messages on my console:
$ DEBUG=Eleventy* netlify dev
I have tried changing the dev.command
property in netlify.toml
to include DEBUG
, but that doesn’t help.
# netlify.toml
[dev]
command = "DEBUG=Eleventy* npm run start"
This also fails to show debug messages on the console:
$ netlify dev -c "DEBUG=Eleventy* npm run start"
I’m missing something simple and my web search-fu is failing me on this one. What do I need to do in order for my 11ty site’s build/serve process to see the DEBUG
environment variable?
Aha!
The environment variable question was moot. The problem lay elsewhere, notably this unexpected message:
Ignoring command setting since using a simple static server. Configure 'command' and 'targetPort' for a custom setup
Did I miss a meeting?
It seems that setting command
and targetPort
as code for “I don’t want you use substitute a simple static server for my dev command” is… cryptic. Was this intentional? Was this just some kind of stopgap? Do i maybe have something wrong in my project that I don’t see?
I’ll poke around, but in the meantime, since I’m not sure what I might be missing (Why doesn’t netlify dev
detect an app server in my 11ty project?), I’d appreciate any suggestions.
Hi @jbrains,
Yes, when specifying a command, you also need to specify the target port as Netlify CLI won’t be able to guess what port your app is now running on. Custom command is considered to be a customer server, thus the need for a target port. You could set it to the port used by Eleventy and it would work.
Thank you. I understand that, although I’m puzzled because I think this used to work. Maybe it never did.
Aha! again
It seems that, since I do some non-standard things with Eleventy, the netlify dev
detector for Eleventy doesn’t detect Eleventy in my project.
In order to reveal intent better, I’ve added framework="eleventy"
to my netlify.toml
configuration.
Mystery solved.