Skip to content

[BUG] Watch mode #79

@lsarrazi

Description

@lsarrazi

Describe the bug
Running tst-reflect in watch mode cause an infinite loop and other weirds errors at runtime

(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency
...

the first compilation in watch mode do actually work, but all the next ones (when we save our files) throw this error at runtime:

_ßr.Type.store.set(2839, { k: 0, isg: false, n: "AnotherOne", fn: "my-webpack-project/src/schemas/schemas.ts:AnotherOne#2839", props: [], indxs: [], args: [] }); 
^

ReferenceError: _ßr is not defined
    at Object.<anonymous> (C:\Users\leo\Documents\enhanced-rest\dist\index.js:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

To Reproduce
Steps to reproduce the behavior:

  1. ttsc --watch

Runtime

  • Node.js version: v16.18.0
    "tst-reflect-transformer": "^0.12.5",
    "ttypescript": "^1.5.13",
    "typescript": "^4.8.4",

Additional context
tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "noImplicitAny": true,
    "module": "Node16",
    "target": "es5",
    "allowJs": true,
    "rootDir": "src",
    "outDir": "dist",
    "plugins": [
      {
        "transform": "tst-reflect-transformer"
      }
    ]
  },
  "ts-node": {
    "compiler": "ttypescript"
},
  "files": ["src/index.ts"]
}

If your're wondering, I just made a getType call on a trivial type to get those errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions