Skip to content

tsc -w should not recompile if a file is created into an excluded folder #27279

Closed
@rolivegab

Description

@rolivegab

Search Terms:
tsc -w watch exclude subfolder recompile

tsconfig.json

  "compilerOptions": {
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    "lib": ["es7"],                             /* Specify library files to be included in the compilation. */
    "sourceMap": true,                     /* Generates corresponding '.map' file. */
    "outDir": "dist",                        /* Redirect output structure to the directory. */
    "rootDir": "src",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
    "strict": true,                           /* Enable all strict type-checking options. */
    "allowSyntheticDefaultImports": true,     /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
    "esModuleInterop": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
    "watch": true,
  },
  "exclude": [
    "node_modules",
    "dist",
    "upload",
  ]
}

Folder structure
image

Expected behavior:
When i create a file into upload/, tsc should not detect file changes.

Actual behavior:

When i create a file into upload/, server detects file changes and do incremental compilation.
i'm using "tsc-watch --onSuccess \"node dist/server.js\"", so, my server is restarted whenever user upload a file.
image

Is there any way to tsc -w not detect file creation in an excluded project's subfolder?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions