infernojs / ts-plugin-inferno

Typescript transformer for InfernoJS
MIT License
3 stars 1 forks source link

Unexpected token error with TypeScript 4.9.3 #4

Closed joonass-visma closed 1 year ago

joonass-visma commented 1 year ago

When trying to do webpack or rollup build with latest TypeScript v4.9.3, it results in unexpected token errors from tsx-files.

To reproduce try running f.e. the webpack example from examples folder. You will get the following error:

ERROR in ./src/index.tsx 27:16
Module parse failed: Unexpected token (27:16)
File was processed with these loaders:
 * ./node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
|     }
|     MyComponent.prototype.render = function () {
>         return (<div>
|         <h1>{"Welcome to Inferno ".concat(version, " TSX ").concat(this.tsxVersion)}</h1>
|         <Incrementer name={"Crazy button"}/>

webpack 5.75.0 compiled with 1 error in 3009 ms

ts-loader claims to be compatible TypeScript: 3.6.3+ so seems like ts-plugin-inferno is the issue here?

Havunen commented 1 year ago

Do you have more details how to reproduce this issue? I tried updating the examples here to latest version and they seem to work as expected? Except that fuse-box example some ES5 compilation issue, but its different problem.

I also tried updating inferno typescript example to latest version and that is also working as expected: https://github.com/infernojs/inferno-typescript-example

joonass-visma commented 1 year ago

How I get it:

  1. Install packages for examples/webpack
  2. Run yarn start
Havunen commented 1 year ago

Hmm interesting that it fails with yarn but not with npm.

These examples don't have yarn set up, I don't know if its supposed to work but I can check

Havunen commented 1 year ago

Ok, it seems yarn got confused when the package had typescript dependency defined as * in dependencies, it somehow took the version from devDependencies. This is now fixed in v1.0.6