Open sigmasoldi3r opened 6 years ago
As tsify is a plugin, issues like this always involve several moving parts - some version of Browserify, Gulp, etc. On top of that, I've not used tsify lately.
I'd suggest you start with a setup that was known to be working and try that. In particular, I'd suggest you start with this repo's JSX example:
https://github.com/TypeStrong/tsify/tree/master/examples/jsx
The build.js
file contains basically what sits within the Gulp task. The typings have changed - with @types
, etc. - so you can remove the .d.ts
file. Anyway, If you are able to reproduce the problem with something as simple as the example, I can probably help.
I've tracked down what creates the error, if you specify the field declarationDir
in tsconfig.json
it will create this error, so removing
"declarationDir": "dist",
from tsconfig.json
fixed the problem. It is supposed to happen this way?
It's not an option that I've ever used. When using tsc
, I've always generated the .d.ts
files beside the .js
files. And I've never specified with when using tsify.
However, I doubt that anything like what you've seen should ever happen. It's a bug.
Disclaimer:
I've been googling around a while I can't find a similar issue, forgive me if it's already discussed.
Browserify or tsify is resolving tyepscripts imports in a bad way: Concatenates the working directory to the full path of the module, for example, if we have:
(Assuming that we're on
/home/user/project/src/
) It will attempt to resolve to:/home/user/project/src/home/user/project/src/pages/Home
instead of/home/user/project/src/pages/Home
, I've followed simple cases shown on readmes but I cannot make it work.My setup:
gulpfile.js
My
tsconfig.json
:Sources used:
App.tsx
:And
pages/home/Home.tsx
:Again sorry if it's been discussed before, but I can't make it work with simple cases. Maybe I'm missing something about the
tsconfig.json
orgulpfile.js
, and thank you for your time.PD: The error stack trace: