lukeed / tsm

TypeScript Module Loader
MIT License
1.19k stars 19 forks source link

Transformation does not support plugins; Not working for Relay #35

Closed theKashey closed 1 year ago

theKashey commented 2 years ago

👋 thanks for amazing tool. Being using it for quite a while and everything was fine... until today :(

Invariant Violation: graphql: Unexpected invocation at runtime. 
Either the Babel transform was not set up, or it failed to identify this call site. 
Make sure it is being used verbatim as `graphql`. 
Note also that there cannot be a space between graphql and the backtick that follows.
..../node_modules/relay-runtime/lib/query/GraphQLTag.js:25:52

We have 3 different ways to run our code:


In order to provide flexibility for the end solution I want to steer issue from "not supporting plugins"(transformSync just dont support it) to the actual problem I am facing with graphql.

Similar problem might occur while using any library which heavy relies on babel transformation step, and might be not for all of them tsm should work (and it does not right now).

But is there anything we can do?

maraisr commented 2 years ago

Hmmm — yeah relay's runtime does an immediate throw coz it relies on transformations. SWC does this trough a built-in transform.

with esbuild there exists a plugin which you can put through a configuration file.

I do not believe tsm to have first-class support for relay, and in this case, please refer to the above.

theKashey commented 2 years ago

Unfortunately tsm configuration (and esbuild.tranformSync) does not support plugins or any other way to transform sources.

lukeed commented 1 year ago

esbuild only accepts plugins via its build method, which isn't used here as you've pointed out.