Yui
Yui2y ago

Override npm import dep with import maps?

Is it possible for me change a depedency of an npm package by using import maps? Say I want to use a different websocket than the base npm package is using.
8 Replies
bpev
bpev2y ago
you mean like npm's package.json "overrides" ya? https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides afaik there isn't any equivalent rn. Is the dep public? The couple times I had small updates I needed in deps, I just forked and pointed to a raw github url... Oh man though this did just remind me of: https://github.com/ds300/patch-package this thing saved my butt a few times when i was engulfed in node dep hell...
Yui
YuiOP2y ago
yeah I cannot fork it and point it to github url. Since I cannot use the npm: mechanism with github. @bpev Or at least I did not find a way to use it with github repos.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Yui
YuiOP2y ago
Tried all of kinds of things with it. Does not seem to work. Maybe it does not work with npm deps.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Yui
YuiOP2y ago
you can do that?
Yui
YuiOP2y ago
Does not seem like vendor works with npm specifiers.
bpev
bpev2y ago
can you run dep from cdn url (skypack et all)? then maybe could use scopes: https://deno.land/manual@v1.30.0/basics/import_maps#overriding-imports actually come to think of it, I never actually tried to use with npm:, but seems sketchy