-
-
Notifications
You must be signed in to change notification settings - Fork 669
unable to import from installed library in node_modules without relative path #1954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Updated the reproduction to checkout a particular branch. |
If import {...} from 'asdom/index' while |
@trusktr May be similar to this question MaxGraey/as-string-sink#1 |
Why not just? import {} from "asdom" |
Yep, that. Types not found in VS Code. Requires an
A few reasons:
|
Does
So really this issue here is that we can't do Also it sounds like tree shaking is very bad for TS/JS. |
I have the same thing. import { console } from '../node_modules/as-console/assembly/wasi' Should be: import { console } from 'as-console/wasi' The |
Seems to go into the direction of finding a better convention, and deprecating |
You could keep |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions! |
Not stale. 🤖💥• • • • 💥🔫 |
It's not purely a bug, as it is kinda by design, but the design itself is kinda a bug, so I guess it is one. We'd need to revert the baseDir computation based on ascMain, which would be a breaking change. |
I've spent some time looking at this problem now, and came to the conclusion that removing Hence going to remove the feature, with documentation soon recommending to simply do As a possible path forwards in the future, Node.js nowadays recognizes the "exports": {
".": {
"import": "./path/to/index.js",
"require": "./path/to/index.cjs",
"types": "./path/to/index.d.ts"
}, where, perhaps, if typical tooling would support it, there could be an |
#1679 got closed by the super ugly stupid stale bot (:robot::boom:• • • • :boom::gun:), so continuing here:
I just tried this on 0.19.5 and I still get an error:
This works though:
Reproduction:
The following works, but TypeScript shows red squigglies and intellisense breaks because AssemblyScript projects are not set up by default to satisfy TypeScript node resolution:
The following doesn't work in AS, but it is proper and TypeScript will see the correct imports and we will get working intellisense:
The text was updated successfully, but these errors were encountered: