You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
import{Home}from'./pages/Home';
(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.
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 or gulpfile.js, and thank you for your time.
PD: The error stack trace:
yarn run v1.5.1
$ gulp typescript
[10:37:54] Using gulpfile ~/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/gulpfile.js
[10:37:54] Starting 'typescript'...
[10:37:55] Finished 'typescript' after 184 ms
/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:76407
throw e;
^
Error: ENOENT: no such file or directory, lstat '/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/dist/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/src/pages/home'
at Object.fs.lstatSync (fs.js:948:11)
at Host._follow (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/tsify/lib/Host.js:278:19)
at Host.writeFile (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/tsify/lib/Host.js:127:29)
at Object.writeFile (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:76266:132)
at Object.writeFile (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:10975:14)
at Object.writeDeclarationFile (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:72349:16)
at emitSourceFileOrBundle (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:72498:34)
at forEachEmittedFile (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:72407:30)
at Object.emitFiles (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:72476:9)
at emitWorker (/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/node_modules/typescript/lib/typescript.js:76340:33)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c gulp typescript
Directory: /home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/home/sigmasoldier/Documents/argochamber/external/dogs-in-blue/dogs-in-blue-home/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The text was updated successfully, but these errors were encountered:
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:
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.
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:
The text was updated successfully, but these errors were encountered: