HewloThere
HewloThere
DDeno
Created by HewloThere on 10/7/2024 in #help
Type resolution for modules imported with `npm:` specifier
moved from here: https://discord.com/channels/684898665143206084/684898665151594506/1292948811643224136 if i'm importing something from npm with an npm: specifier (i.e. npm:vite), if it has type definitions that reference another npm package (i.e. esbuild), is it a deno issue or a package issue if the types aren't resolved by deno (at least, the deno vscode extension)? tried with both npm:vite@5.4.8 as well as npm:vite@6.0.0-beta.2 and both of them don't load the types of esbuild when importing. i don't have this issue when importing it from esm.sh, though. and if i manually add esbuild to the imports in my deno.json, it works too. but not if i directly import from npm:vite. if this is to be expected then that's all good, just was wondering if i should report an issue or anything 🙂 actually, it correctly resolves the type (in the vscode extension?) up until i try to look at the types for vite. not sure if it's just flaky, but it seems to only work (until i navigate to the types for vite) if i tell deno to generate a lock file and i have run deno clean? i think? e.g.: deno.json:
{
"lock": true,
"imports": {
"vite": "npm:vite@^6.0.0-beta.2",
"esbuild": "npm:esbuild@^0.24.0",
"postcss": "npm:postcss@^8.4.47",
"rollup": "npm:rollup@^4.22.5"
}
}
{
"lock": true,
"imports": {
"vite": "npm:vite@^6.0.0-beta.2",
"esbuild": "npm:esbuild@^0.24.0",
"postcss": "npm:postcss@^8.4.47",
"rollup": "npm:rollup@^4.22.5"
}
}
file.ts
import { build } from 'vite';

await build({
// stuff
esbuild: {
loader: 'tsx', // error is here, but only after i try to look at the types for vite in vscode.
},
});
import { build } from 'vite';

await build({
// stuff
esbuild: {
loader: 'tsx', // error is here, but only after i try to look at the types for vite in vscode.
},
});
26 replies
DDeno
Created by HewloThere on 10/4/2024 in #help
deno gives 401 unauthorized for imports with an `npm:` specifier, but npm, yarn and pnpm all work?
heya! i'm having difficulty with getting npm: specifiers to work. i've tried them via an import like below, or running via the cli. both give a 401 error for any package (regardless of if it's scoped, unscoped, using a specific npm config registry or anything). i tried this in all of stable, canary and rc deno versions - all have the same. i'll include debug logs from the latest rc it used to work a few weeks ago, then it stopped working with all versions for a bit, then i created a new artifactory token and put that in my npmrc and it worked for a few days, and now it's back to not working again? if it makes any difference, i'm using company vpn. and i had vscode closed and i was using a new terminal for this test, same result :/ both of these don't work and give this error:
error: Error getting response at https://packages.mycompany.com/artifactory/api/npm/npm-remote/@angular/cli for package "@angular/cli": Bad response: 401

{
"errors" : [ {
"status" : 401,
"message" : "Bad credentials"
} ]
}
error: Error getting response at https://packages.mycompany.com/artifactory/api/npm/npm-remote/@angular/cli for package "@angular/cli": Bad response: 401

{
"errors" : [ {
"status" : 401,
"message" : "Bad credentials"
} ]
}
import { thing } from 'npm:literally-anything';
import { thing } from 'npm:literally-anything';
deno run -A npm:@angular/cli
deno run -A npm:@angular/cli
i'll add debug logs and configs in the following messages
25 replies