ntzwrk / blockstack.ts

work in progress, please check back later
MIT License
10 stars 1 forks source link

"An import path cannot end with a '.ts' extension." #17

Open sneurlax opened 6 years ago

sneurlax commented 6 years ago

When I try import * as blockstack fromblockstack.ts'` I get the error:

An import path cannot end with a '.ts' extension. Consider importing '/node_modules/blockstack' instead.
vsund commented 6 years ago

Yup, that's because I uploaded an empty package to NPM. Technically there's nothing to import, which gets the compiler to think that the package was misspelled.

If you'd like to try this out though, you can use yarn link ;)

sneurlax commented 6 years ago

I used npm i --save https://github.com/ntzwrk/blockstack.ts.git, so I should have the latest version from git.

sneurlax commented 6 years ago

This import * as blockstack from 'blockstack'; results in this, which may not be an issue on your end at all (I think it's from Stencil, which is still in alpha.)

[27:46.0]  changed file: ionic-pwa-toolkit.tsx
[27:46.0]  rebuild, app, dev mode, started ...
[27:46.0]  compile started ...

[ ERROR ]  tsHost.getSourceFile unable to find: /home/user/github/ionic-pwa-toolkit/node_modules/blockstack.ts EISDIR:
           illegal operation on a directory, read Error: EISDIR: illegal operation on a directory, read at
           Object.fs.readSync (fs.js:690:18) at tryReadSync (fs.js:554:20) at Object.fs.readFileSync (fs.js:597:19) at
           NodeFs.readFileSync (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/sys/node/index.js:682:19)
           at InMemoryFileSystem.readFileSync
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:1851:39) at
           Object.tsHost.getSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:7099:34) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76883:29) at processImportedModules
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:77055:25) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76931:17) at args
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76819:85)

[ ERROR ]  tsHost.getSourceFile unable to find: /home/user/github/ionic-pwa-toolkit/node_modules/blockstack.ts EISDIR:
           illegal operation on a directory, read Error: EISDIR: illegal operation on a directory, read at
           Object.fs.readSync (fs.js:690:18) at tryReadSync (fs.js:554:20) at Object.fs.readFileSync (fs.js:597:19) at
           NodeFs.readFileSync (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/sys/node/index.js:682:19)
           at InMemoryFileSystem.readFileSync
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:1851:39) at
           Object.tsHost.getSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/@stencil/core/dist/compiler/index.js:7099:34) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76883:29) at processImportedModules
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:77055:25) at findSourceFile
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76931:17) at args
           (/home/user/github/ionic-pwa-toolkit/node_modules/typescript/lib/typescript.js:76819:85)

[27:49.6]  compile finished in 3.58 s

[ ERROR ]  typescript: src/components/ionic-pwa-toolkit/ionic-pwa-toolkit.tsx, line: 4
           Cannot find module 'blockstack'.

      L4:  import * as blockstack from 'blockstack';
sneurlax commented 6 years ago

And I mean, there is definitely this repo in my node_modules/blockstack.ts/, I just don't know how to use it. Maybe too early of a state and I should find a workaround with blockstack.js?

vsund commented 6 years ago

import * as blockstack from 'blockstack'; references the original library and not this fork.

I guess you removed the .ts at the end because of the initial error? The NPM version for blockstack.ts currently has no code (that's why the compiler complaints). For me locally everything works with yarn link.

I guess the npm i --save https://github.com/ntzwrk/blockstack.ts.git did not what it should. Can you check whether there's code in ./node_modules/blockstack.ts/dist/? Maybe it didn't trigger the build process (which then would be a different error for later).