The front end of the plurality of items using common components Vue npm link

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/milugloomy/article/details/84637659

background

Connect an article entitled " Use of multiple front-end projects Vue common components publish npm ", using node_module way into the public projects, public projects after modification, every time npm install the reintroduction of public projects, if frequent changes in public projects, This has resulted in the development process debugging great inconvenience.

This talk of a private npm package depends on local development and debugging frequently updated solutions npm link

Solve the problem

Is still one of the three projects, doctor, patient, aikang-common. Where the doctor and patient are doctors end and patient end, aikang-common for public projects, which contains a number of common components for calls.

First enter aikang-common project of the console, enter

npm link

This will create a soft link and save it to the directory C: \ Users \ Administrator \ AppData \ Roaming npm \ node_modules below \.

Then enter the doctor and patient project, input

npm link aikang-common

This will be the introduction of a common project by means of soft-wired to the project came inside.

Then modify aikang-common project following arbitrary code will take effect immediately, without packing, do not restart.

aikang-common use of common components, refer to this one, " aikang-common common component calls the method "

Of course, npm link is only recommended way function used during the development, if a stable common module, it is recommended to use npm publish the embodiment, the common packet incorporated node_module manner.

Guess you like

Origin blog.csdn.net/milugloomy/article/details/84637659