Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] --watch for transformer changes #117

Open
RedMser opened this issue Jul 28, 2023 · 1 comment
Open

[Feature Request] --watch for transformer changes #117

RedMser opened this issue Jul 28, 2023 · 1 comment

Comments

@RedMser
Copy link

RedMser commented Jul 28, 2023

When using tspc --watch, I expect changes in transformers that are defined inside of my project (such as { transform: ./transformer.js } ) to be detected and TypeScript to re-compile the entire project. However, this does not happen.

@theogravity
Copy link

theogravity commented Jun 5, 2024

I have a use-case where I have a monorepo with several packages. Our tsconfig.json at the root as a bunch of these references, and we use the following command to watch and re-build:

tsc --build tsconfig.json --watch --preserveWatchOutput --verbose

Some of the references uses ts-patch with their own transformer plugins. In their own directories, running tsc directly (after ts-patch patch) works as it should.

But running that watch command from the root, I've tried tsc with the patch applied, and also tspc directly on the command, but it doesn't seem to execute those plugins.

I've also tried copying the plugin config over to the root and it doesn't seem to use the plugins as well.

ex: root tsconfig.json attempt (note: I added the plugins option here to just try to see if it would work; ideally it should just build with the plugins of that package)

{
  "compilerOptions": {
    "plugins": [
      {
        "transform": "typescript-file-copy-plugin",
        "after": true,
        "copy": [
          {
            "src": "./packages/utils/src/generated/*",
            "dest": "./packages/utils/dist/src/generated"
          }
        ]
      }
    ]
  },
  "files": [],
  "references": [,
    { "path": "./packages/utils" },
}

Edit: even tspc --build tsconfig.json doesn't activate the transformers from the root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants