The dotfiles option now defaults to "ignore" (Express 4 served dotfiles by default). Files inside a directory that starts with a dot (.), such as .well-known, will no longer be accessible and will return a 404 Not Found error.
The hidden option is removed and replaced by dotfiles.
The from option (an undocumented alias for root) is removed and replaced by root.
This codemod updates express.static() calls to preserve the Express 4 behavior:
Adds an explicit dotfiles: 'allow' option to calls that don't already specify a dotfiles (or hidden) option.
After running this codemod, review each express.static() call to determine if serving dotfiles is actually necessary for your application. If you don't need to serve dotfiles, you can:
Remove the dotfiles: 'allow' option to use the new Express 5 default ("ignore")
Or explicitly set dotfiles: 'deny' to return a 403 Forbidden for dotfile requests
For directories like .well-known that need to be served (e.g., for Android App Links or Apple Universal Links), consider serving them explicitly: