Skip to content

Instantly share code, notes, and snippets.

@iki
Last active August 27, 2024 05:35
Show Gist options
  • Save iki/51b13522da866059ee4d7b1065d5165c to your computer and use it in GitHub Desktop.
Save iki/51b13522da866059ee4d7b1065d5165c to your computer and use it in GitHub Desktop.
tsx include dotfile issue reproduction
TEST_VAR=7
# About: https://help.github.com/articles/ignoring-files
# Format: https://git-scm.com/docs/gitignore#_pattern_format
## Dependencies
node_modules/
package-lock.json
pnpm-lock.yaml
yarn.lock

tsx include dotfile issue reproduction

Steps to reproduce

  1. Install dependencies
pnpm install  # or: npm install
  1. Run tsx watch
pnpm start  # or: npm run start

# or directly:
tsx watch --clear-screen=false --include .env -r dotenv-flow/config -- index.ts
  1. Change content of .env
  • Expected result: tsx restarts the script
  • Actual result: dotfiles are ignored
console.log(`Started with TEST_VAR='${process.env.TEST_VAR ?? ''}'`)
console.log(`Exiting. Press Return to restart in tsx watch mode...`)
{
"name": "tsx-include-dotfile",
"version": "0.0.1",
"license": "MIT",
"main": "index.js",
"type": "module",
"scripts": {
"start": "tsx watch --clear-screen=false --include .env -r dotenv-flow/config -- index.ts"
},
"devDependencies": {
"@types/node": "^22.5.0",
"dotenv-flow": "^4.1.0",
"tsx": "^4.18.0",
"typescript": "^5.5.4"
},
"dependencies": {
"@inquirer/prompts": "^5.3.8"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment