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

[BUG] Watch mode #79

Open
lsarrazi opened this issue Oct 30, 2022 · 1 comment
Open

[BUG] Watch mode #79

lsarrazi opened this issue Oct 30, 2022 · 1 comment
Labels
bug Something isn't working enhancement New feature or request in-progress

Comments

@lsarrazi
Copy link

lsarrazi commented Oct 30, 2022

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

@lsarrazi lsarrazi added bug Something isn't working enhancement New feature or request labels Oct 30, 2022
@lsarrazi lsarrazi changed the title [BUG] [BUG] Watch mode Oct 30, 2022
@Hookyns
Copy link
Owner

Hookyns commented Oct 31, 2022

Hi @lsarrazi,

the issue with _ßr is not defined is a known issue, fixed in new upcoming major version.
You can hotfix it by adding this to some main TS file:

import { Type, getType } from "tst-reflect";
(window as any)._ßr = { Type, getType };

But I have to check that
(node:2824) Warning: Accessing non-existent property 'tracing' of module exports inside circular dependency,
that's new for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request in-progress
Projects
None yet
Development

No branches or pull requests

2 participants