简体   繁体   中英

Build private npm package on existing project from node_modules

I have a private npm package (that is in a private registry as well), I have been considering different options for testing. Since the package, only runs within applications, I cannot simply test locally. Although, I would prefer not to test by publishing on each change and updating a new version only to find out that I have a new bug.
One idea I had was make changes in the package code which is in the node_modules on one of my apps that use an older version, then re-build the package inside the node modules test it and see if works as expected, if it does then I would publish the updated version of the package for all my apps. Is this possible?
Note : I cannot really make changes to the dist folder which is used since once built it is unrecognizable and not really workable even if technically possible.

If you want to test your own package, you can include it in the dependencies in the package.json file, like these -

{
  },
  "dependencies": {
    "mymodule": "file:../MYMODULE",
    "mypackage": "file:../MYPACKAGE"
  },

}

You should mention the path here, if its located in the same folder as your existing project, you can use the path as i have shown in the example.

显然,您可以导航到包(在 node_modules 中)并在那里构建,不确定这是否适用于所有软件包,但它适用于我的私有软件包。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM