MariusVatasoiu
MariusVatasoiu5mo ago

esbuild-deno-loader with npm private registry

Did anyone used the esbuild-deno-loader with npm: specifier while using a private npm registry that requires authentication? Does Deno use the npmrc in any way? I saw the option to set a custom registry, but what about the credentials? I'm getting the "Module not found" error and not sure why. I have the feeling it's a network issue, but the error is too vague.
6 Replies
marvinh.
marvinh.5mo ago
npm stores auth tokens in .npmrc in the users home dir afaik. Could be that the esbuild deno loader isn't respecting that
MariusVatasoiu
MariusVatasoiu5mo ago
Is this something that the loader should do or the runtime itself?
marvinh.
marvinh.5mo ago
I'm not familiar enough with the internals of esbuild loader to guess if the problem is there or in deno
MariusVatasoiu
MariusVatasoiu5mo ago
I'm using Luca's plugin: https://github.com/lucacasonato/esbuild_deno_loader But from the source code I don't see anything related with the npmrc file
GitHub
GitHub - lucacasonato/esbuild_deno_loader: Deno module resolution f...
Deno module resolution for esbuild. Contribute to lucacasonato/esbuild_deno_loader development by creating an account on GitHub.
MariusVatasoiu
MariusVatasoiu5mo ago
And, since the npm: specifier is built in the runtime, I'm expecting to be some config related with the runtime my deno.json looks somthing like this:
{
"imports": {
"lit": "npm:lit@^2.0.0"
}
}
{
"imports": {
"lit": "npm:lit@^2.0.0"
}
}
// buil.ts
import * as esbuild from 'npm:esbuild@0.20.2';
// Import the WASM build on platforms where running subprocesses is not
// permitted, such as Deno Deploy, or when running without `--allow-run`.
// import * as esbuild from "https://deno.land/x/esbuild@0.20.2/wasm.js";

import { denoPlugins } from 'jsr:@luca/esbuild-deno-loader@^0.10.3';

const result = await esbuild.build({
plugins: [...denoPlugins()],
entryPoints: ['./static/index.js'],
outfile: './dist/static.esm.js',
bundle: true,
format: 'esm'
});

console.log(result.outputFiles);

esbuild.stop();
// buil.ts
import * as esbuild from 'npm:esbuild@0.20.2';
// Import the WASM build on platforms where running subprocesses is not
// permitted, such as Deno Deploy, or when running without `--allow-run`.
// import * as esbuild from "https://deno.land/x/esbuild@0.20.2/wasm.js";

import { denoPlugins } from 'jsr:@luca/esbuild-deno-loader@^0.10.3';

const result = await esbuild.build({
plugins: [...denoPlugins()],
entryPoints: ['./static/index.js'],
outfile: './dist/static.esm.js',
bundle: true,
format: 'esm'
});

console.log(result.outputFiles);

esbuild.stop();
MariusVatasoiu
MariusVatasoiu5mo ago
My problem might be related with https://github.com/denoland/deno/issues/19900 I think I can't use a private npm registry that requires auth.
GitHub
DENO_AUTH_TOKENS does not authenticate against npm.pkg.github.com ·...
Hi, I'm doing a POC to see if our company can start replacing node with deno. I have a private npm package in npm.pkg.github.com that I'm trying to import. I'm trying to run a single-li...
More Posts
how to load env variables from .env file in taskthe `source` shell command is not available. I tried ``` "tasks": { "my-task": "export .env &&Is there a way to specify a range and list from KV?```typescript const kv = await Deno.openKv(); kv.set(["parent", 1], "key1") kv.set(["parent", 2], "kPermissionDenied while using ioredis npm packageHello, I'm facing an issue with an npm library ioredis (https://github.com/redis/ioredis). For someIs there a way to obtain Deno.cron schedule info?Deploy lists the registered cron jobs with name, schedule, last run and next run. Is there a programVisual Studio Code Deno does not use node typesI'm trying to use the "esquery" node library with its types, but for any reason Deno ignores the typDrop permissionsI'd like to harden my deno app a bit, but specifying permissions manually gets repetitive. Is there New fresh project comes out of the box with errorsI created a new fresh project on linux, I am using VsCode and im getting many errors although the prIs there a deno function for inputting prompt reply without pressing enter?Normally, one has to press enter for the input to be accepted. I was wondering if there was a versioSetting Deno.Command priority and affinity (on windows)Is it possible to set a tasks / commands priority and affinity directly? Code: ```ts await new DenoIs there a way to write a Deno.AtomicCheck that succeeds for any non-null versionstamp?You can write a Deno.AtomicCheck that fails if the versionstamp for a key-value pair in the KV store