码迷,mamicode.com
首页 > 其他好文 > 详细

yarn  workspace 开发示例

时间:2017-11-10 20:26:56      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:asc   robot   lis   font   play   normal   imp   port   mon   

此为官方示例:
package.json
{
    "private": true,
    "workspaces": [
        "workspace-a",
        "workspace-b"
    ]
}

Note that the private: true is required! Workspaces are not meant to be published, so we’ve added this safety measure to make sure that nothing can accidentaly expose them.

After this file has been created, create two new subfolders named workspace-a and workspace-b. In each of them, create another package.json file with the following content:

 
workspace-a/package.json:

 

{
    "name": "workspace-a",
    "version": "1.0.0",

    "dependencies": {
        "cross-env": "5.0.5"
    }
}
workspace-b/package.json:
{
    "name": "workspace-b",
    "version": "1.0.0",

    "dependencies": {
        "cross-env": "5.0.5",
        "workspace-a": "1.0.0"
    }
}
Finally, run yarn install somewhere, ideally inside the workspace root. If everything works well, you should now have a similar file hierarchy:

yarn  workspace 开发示例

标签:asc   robot   lis   font   play   normal   imp   port   mon   

原文地址:http://www.cnblogs.com/rongfengliang/p/7815927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!