How to bundle dependencies in npm package?

痴心易碎 提交于 2019-12-08 07:37:17

问题


I have a npm package which reference an other local package. It has a structure like so.

  • deploy
    • typescriptapp.tgz
  • references
    • mydependency
      • package.json
      • app.js
      • app.css
  • typescriptapp
    • package.json
  • webapp

My typescriptapp package.json has the following dependencies

  "dependencies": {
    "mydependency": "file:../references/mydependency"
  },

My webapp package.json has the following dependencies

  "dependencies": {
    "typescriptapp": "file:../deploy/typescriptapp-1.0.0.tgz"
  },

When I use npm pack it work fine, but it is not included in the tarball. I also move the tarball to a deploy folder

When I try npm install, it doesn't work because the reference folder does not exist in the deploy folder.

I also tried to change the dependencies for bundledDependencies

  "bundledDependencies": [
    "file:../references/mydependency"
  ]

But it does not seem to work either.

How do I pack my typescript app to be able to install it in my webapp with a single file?

来源:https://stackoverflow.com/questions/49500192/how-to-bundle-dependencies-in-npm-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!