Firebase Functions with Yarn workspaces

后端 未结 2 2024
耶瑟儿~
耶瑟儿~ 2021-02-05 14:33

We\'re starting to adopt a monorepo setup using yarn workspaces and we\'d like to have our firebase functions inside it. The repo structure is something like:

re         


        
2条回答
  •  忘掉有多难
    2021-02-05 15:01

    I am not sure I understand the question exactly, but I could give you my two cents on yarn workspaces based on whatever I understood from your question and from my experience using it.

    Yarn workspaces consolidate all your dependencies into the node_modules present in project root as well as in a single package-lock.json to reduce conflicts and enables yarn to optimize the installation process giving you a faster yarn install. And also another advantage of it is, with a single pass yarn install can install dependencies of all packages under the workspace.

    Edit: I think for some reason yarn link is not being called and instead only yarn install is being run, which will search the npm registries and throws the error mentioned in comment since it can't find the mentioned package on npm registry. So for a solution try creating an entry in the firebase's package.json like

    "dependencies": {
      "a": "file:../dependency-package-name/",
    }
    

提交回复
热议问题