S
S
SomeHuman22021-12-29 22:56:43
npm
SomeHuman2, 2021-12-29 22:56:43

How to use npm link?

Hello, in order to develop and use the webpack loader, I need the local repository to be one of the node-modules
I did
on the way

myProotProject/resources/loaders/first-loader> npm link

result
up to date, audited 3 packages in 5s
found 0 vulnerabilities

Along the way the myProotProject> npm link first-loader
result
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/first-loader - Not found
npm ERR! 404 
npm ERR! 404  '[email protected]*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Why is the loader searched from npm and not local via link?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2021-12-29
@SomeHuman2

https://docs.npmjs.com/cli/v7/commands/npm-link#sy...
Example at the very beginning.
The bottom line is that npm link needs to be used 2 times, first in the folder of the linked package without parameters, then in the folder where we link with the name of the linked package from its package.json
But in general this is a debugging tool, and for your purposes it is better to just give webpack absolute the path to the file with the loader, which is easiest to get through require.resolve

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question