这是indexloc提供的服务,不要输入任何密码
Skip to content

taskkill issue on 7.2.0 #976

@barrybtw

Description

@barrybtw

Problem

When running pnpm run dev / tsup --watch, it initially builds and start up just fine, but after saving a file, I get the following taskkill error:

Error: Command failed: taskkill /pid 2464 /T /F
ERROR: The process "2464" not found.

    at ChildProcess.exithandler (node:child_process:419:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)

I have found no issues with version 7.1.0, or any versions below.

My system

  • Windows: 11 Home, 22H2
  • Node: 18.6.0

Files

tsup.config.ts

import { defineConfig } from 'tsup';

const isDev = process.env.npm_lifecycle_event === 'dev';

export default defineConfig({
  clean: true,
  dts: true,
  entry: ['src/index.ts'],
  format: ['esm'],
  minify: !isDev,
  metafile: !isDev,
  sourcemap: true,
  target: 'esnext',
  outDir: 'dist',
  onSuccess: isDev ? 'node dist/index.js' : undefined,
});

package.json

{
  "name": "create-drippy-api",
  "version": "0.0.1",
  "description": "Create a typescript based api with a single command",
  "license": "MIT",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/barrybtw/create-drippy-api.git"
  },
  "keywords": [
    "api",
    "typescript",
    "orm",
    "backend",
    "simplicity"
  ],
  "type": "module",
  "exports": "./dist/index.js",
  "bin": {
    "create-drippy-api": "dist/index.js"
  },
  "engines": {
    "node": ">=14.16"
  },
  "scripts": {
    "typecheck": "tsc --noEmit",
    "build": "tsup",
    "dev": "tsup --watch",
    "clean": "rm -rf dist",
    "start": "node dist/index.js",
    "pub:beta": "pnpm build && npm publish --tag beta",
    "pub:latest": "pnpm build && npm publish"
  },
  "devDependencies": {
    "@types/node": "^20.4.6",
    "tsup": "7.1.0",
    "typescript": "^5.1.6"
  },
  "dependencies": {
    "chalk": "^5.3.0"
  }
}

tsconfig.json

{
  "compilerOptions": {
    /* LANGUAGE COMPILATION OPTIONS */
    "target": "ESNext",
    "lib": ["DOM", "DOM.Iterable", "ES2020"],
    "module": "NodeNext",
    "moduleResolution": "nodenext",
    "resolveJsonModule": true,
    "allowJs": false,

    //
    "paths": {
      "@/*": ["./src/*"]
    },

    /* EMIT RULES */
    "outDir": "./dist",
    "noEmit": true, // TSUP takes care of emitting js for us, in a MUCH faster way
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "removeComments": true,

    /* TYPE CHECKING RULES */
    "strict": true,
    // "noImplicitAny": true, // Included in "Strict"
    // "noImplicitThis": true, // Included in "Strict"
    // "strictBindCallApply": true, // Included in "Strict"
    // "strictFunctionTypes": true, // Included in "Strict"
    // "strictNullChecks": true, // Included in "Strict"
    // "strictPropertyInitialization": true, // Included in "Strict"
    "noFallthroughCasesInSwitch": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "useUnknownInCatchVariables": true,
    "noUncheckedIndexedAccess": true, // TLDR - Checking an indexed value (array[0]) now forces type <T | undefined> as there is no confirmation that index exists
    // THE BELOW ARE EXTRA STRICT OPTIONS THAT SHOULD ONLY BY CONSIDERED IN VERY SAFE PROJECTS
    // "exactOptionalPropertyTypes": true, // TLDR - Setting to undefined is not the same as a property not being defined at all
    // "noPropertyAccessFromIndexSignature": true, // TLDR - Use dot notation for objects if youre sure it exists, use ['index'] notaion if unsure

    /* OTHER OPTIONS */
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    // "emitDecoratorMetadata": true,
    // "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true,
    "useDefineForClassFields": true
  },
  "include": ["src", "tsup.config.ts"]
}

src/index.ts

import { logger } from './lib/logger.js';

const main = async () => {
  logger.info('Hello, world!');
  process.exit(0); // This has no effect if it's here or not
};

main().catch((error) => {
  logger.info(error);
  process.exit(1); // This has no effect if it's here or not
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions