{"id":6318,"date":"2021-11-15T09:00:41","date_gmt":"2021-11-15T00:00:41","guid":{"rendered":"https:\/\/www.sria.co.jp\/blog\/?p=6318"},"modified":"2021-12-08T13:21:28","modified_gmt":"2021-12-08T04:21:28","slug":"6318","status":"publish","type":"post","link":"https:\/\/www.sria.co.jp\/blog\/2021\/11\/6318\/","title":{"rendered":"JS\u596e\u95d8\u8a18\u3010yarn workspace\u3092\u4f7f\u3063\u305f\u30e2\u30ce\u30ec\u30dd\u7ba1\u7406\u3011"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002<br \/>\n\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u8fbb\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u30bf\u30a4\u30c8\u30eb\u901a\u308a\u3001yarn workspace\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u3068\u3066\u3082\u826f\u3044\u6a5f\u80fd\u3067\u3057\u305f\u306e\u3067\u3001\u5099\u5fd8\u9332\u3092\u517c\u306d\u3066\u30d6\u30ed\u30b0\u306b\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>yarn workspace\u3068\u306f\uff1f<\/h2>\n<p><a href=\"https:\/\/classic.yarnpkg.com\/lang\/en\/docs\/workspaces\/\" rel=\"noopener\" target=\"_blank\"><strong>yarn workspace<\/strong><\/a>\u3068\u306f\u3001\u8907\u6570\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30921\u3064\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3067\u307e\u3068\u3081\u3066\u7ba1\u7406\u3067\u304d\u308b\u6a5f\u80fd\u3067\u3059\u3002<br \/>\n\u3044\u308f\u3086\u308b\u30e2\u30ce\u30ec\u30dd\u3068\u547c\u3070\u308c\u308b\u74b0\u5883\u3092\u4f5c\u308c\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u3042\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8A\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002<br \/>\n\u30d7\u30ed\u30b8\u30a7\u30af\u30c8A\u306f\u3001\u3082\u3068\u3082\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068\u30b5\u30fc\u30d0\u30fc\u306e2\u3064\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u3042\u308b\u3060\u3051\u3067\u3057\u305f\u3002<br \/>\n\u2026\u304c\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u62e1\u5f35\u306b\u4f34\u3044\u3001\u65b0\u6a5f\u80fd\u7528\u306b\u65b0\u3057\u3044\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u7acb\u3066\u305f\u308a\u3001\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u306e\u305f\u3081\u306b\u65b0\u3057\u3044\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u7acb\u3066\u305f\u308a\u306a\u3069\u2026\u3001<br \/>\n\u6642\u9593\u304c\u7d4c\u904e\u3059\u308b\u306b\u3064\u308c\u3066\u3001\u7ba1\u7406\u3059\u308b\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u5897\u3048\u3066\u3057\u307e\u3046\u2026\u3068\u3044\u3063\u305f\u4e8b\u3001\u3088\u304f\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u3046\u3044\u3063\u305f\u6642\u306b<strong>yarn workspace<\/strong>\u306f\u3001\u975e\u5e38\u306b\u4fbf\u5229\u3067\u3059\u3002<br \/>\n1\u3064\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u4e2d\u3067\u3001\u5404\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4e00\u62ec\u7ba1\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u5b9f\u73fe\u3057\u305f\u304b\u3063\u305f\u3053\u3068<\/h3>\n<p>yarn workspace \u3092\u4f7f\u3063\u3066\u3001\u5b9f\u73fe\u3057\u305f\u304b\u3063\u305f\u306e\u304c<strong>TypeScript\u306e\u95a2\u6570\u3084\u578b\u3092\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3067\u5171\u6709\u3059\u308b\u4e8b<\/strong>\u3067\u3059\u3002<br \/>\n\u69cb\u6210\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3053\u306e\u69cb\u6210\u306b\u3059\u308b\u3053\u3068\u3067\u3001\/packages\/common\/ \u306e\u4e2d\u306b\u683c\u7d0d\u3057\u3066\u3042\u308b\u30b3\u30fc\u30c9\u3092client01 \/ client02 \/ server\u3067\u5171\u6709\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\nroot\n\u251c\u2500\u2500 package.json\n\u2514\u2500\u2500 packages\n \u00a0\u00a0 \u251c\u2500\u2500 common \u2026 client01 \/ client02 \/ server \u3067\u5171\u6709\u3059\u308bTypeScript\u30b3\u30fc\u30c9\u3092\u683c\u7d0d\u3057\u307e\u3059\u3002\n \u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 functions \u2026 \u5171\u6709\u3059\u308b\u95a2\u6570\u3092\u683c\u7d0d\u3057\u307e\u3059\n \u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 types \u2026 \u5171\u6709\u3059\u308b\u578b\u3092\u683c\u7d0d\u3057\u307e\u3059\n \u00a0\u00a0 \u2502\n \u00a0\u00a0 \u251c\u2500\u2500 client01 \u2026 \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b91\u3002\u4eca\u56de\u306fNext.js\u3092\u5165\u308c\u307e\u3059\u3002\n \u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 package.json\n \u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 tsconfig.json\n \u00a0\u00a0 \u2502\n \u00a0\u00a0 \u251c\u2500\u2500 client02 \u2026 \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b92\u3002\u3053\u3061\u3089\u3082Next.js\u3067\u3059\u3002\n \u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 package.json\n \u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 tsconfig.json\n \u00a0\u00a0 \u2502\n \u00a0\u00a0 \u2514\u2500\u2500 server \u2026 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3002Express\u3092\u5165\u308c\u307e\u3059\u3002\n \u00a0\u00a0  \u00a0\u00a0 \u251c\u2500\u2500 package.json\n \u00a0\u00a0  \u00a0\u00a0 \u2514\u2500\u2500 tsconfig.json\n<\/pre>\n<p>\u4eca\u56de\u306f\u3001TypeScript\u306e\u30b3\u30fc\u30c9\u3060\u3051\u3092\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3067\u5171\u6709\u3057\u307e\u3059\u304c\u3001\u3084\u308d\u3046\u3068\u601d\u3048\u3070\u3001CSS\uff08SCSS\uff09\u3084\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3001\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u306e\u5171\u6709\u306a\u3069\u3082\u53ef\u80fd\u3067\u3059\u3002\uff08\u74b0\u5883\u69cb\u7bc9\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u304b\u3082\u3067\u3059\u304c\u2026\u3002\uff09<\/p>\n<p>\u3088\u308a\u9ad8\u5ea6\u306a\u4e8b\u3092\u5b9f\u73fe\u3057\u305f\u3044\u5834\u5408\u306f\u3001<a href=\"https:\/\/nx.dev\/\" rel=\"noopener\" target=\"_blank\"><strong>Nx<\/strong><\/a>\u3084<a href=\"https:\/\/lerna.js.org\/\" rel=\"noopener\" target=\"_blank\"><strong>Lerna<\/strong><\/a>\u306a\u3069\u306e\u30e2\u30ce\u30ec\u30dd\u4f5c\u6210\u30c4\u30fc\u30eb\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u6d3b\u7528\u3057\u3066\u307f\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h2>yarn workspace \u306b\u3088\u308b\u30e2\u30ce\u30ec\u30dd\u4f5c\u6210\u306e\u624b\u9806<\/h2>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30e2\u30ce\u30ec\u30dd\u74b0\u5883\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306b\u5927\u307e\u304b\u306a\u624b\u9806\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002\u3053\u308c\u306b\u6cbf\u3063\u3066\u3044\u304f\u3068\u30e2\u30ce\u30ec\u30dd\u74b0\u5883\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u30eb\u30fc\u30c8\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u7528\u610f<\/li>\n<li>packages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210<\/li>\n<li>packages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u4f5c\u6210<\/li>\n<li>packages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306bcommon\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210<\/li>\n<li>\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306epackage.json\u306bprivate\/workspace\u3092\u8ffd\u52a0<\/li>\n<li>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\uff08client01\/client02\uff09\u3092\u6574\u5099<\/li>\n<li>\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\uff08server\uff09\u3092\u6574\u5099<\/li>\n<li>\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306epackage.json\u306bscript\u3092\u8ffd\u52a0<\/li>\n<li>\u6700\u7d42\u8abf\u6574\u3092\u3057\u3066\u5b8c\u6210<\/li>\n<\/ol>\n<h3>\u30eb\u30fc\u30c8\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u7528\u610f<\/h3>\n<p>\u307e\u305a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u305d\u3057\u3066\u3001\u4f5c\u6210\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3066\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u521d\u671f\u5316\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u9806\u306b\u5b9f\u884c\u3057\u3066\u3044\u3051\u3070OK\u3067\u3059\u3002<\/p>\n<pre>\nmkdir root\n<\/pre>\n<pre>\ncd root\n<\/pre>\n<pre>\nyarn init -y\n<\/pre>\n<h3>packages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210<\/h3>\n<p>\u6b21\u306b\u3001root\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u76f4\u4e0b\u306bpackages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\npackages\u4f5c\u6210\u5f8c\u306f\u3001packages\u306b\u79fb\u52d5\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>\nmkdir packages && cd packages\n<\/pre>\n<h3>packages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u4f5c\u6210<\/h3>\n<p>packages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u3001\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\uff08\u305d\u306e1\uff09\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306fNext.js\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>\nnpx create-next-app client01 --typescript\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3089\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\uff08\u305d\u306e2\uff09\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>\nnpx create-next-app client02 --typescript\n<\/pre>\n<p>\u3055\u3066\u3001\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3089\u3001\u6b21\u306f\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305aserver\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u3001\u305d\u306e\u4e2d\u306b\u5165\u308a\u307e\u3059\u3002<\/p>\n<pre>\nmkdir server && cd server\n<\/pre>\n<p>\u6b21\u306b\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u521d\u671f\u5316\u3057\u307e\u3059\u3002<\/p>\n<pre>\nyarn init -y\n<\/pre>\n<h3>packages\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306bcommon\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210<\/h3>\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\/\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3067\u5171\u901a\u306e\u30b3\u30fc\u30c9\u3092\u683c\u7d0d\u3059\u308bcommon\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre>\nmkdir common\n<\/pre>\n<p>common\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e2d\u306b\u3001types\u3068functions\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\ntypes\u306b\u306f\u5171\u901a\u306e\u578b\u30d5\u30a1\u30a4\u30eb\u3092\u683c\u7d0d\u3057\u3001functions\u306b\u306f\u5171\u901a\u306e\u95a2\u6570\u3092\u683c\u7d0d\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre>\nmkdir common\/types && mkdir common\/functions\n<\/pre>\n<p>\u3067\u306f\u3001\u5171\u901a\u5316\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\nroot\/packages\/common\/types\u306buser.ts\u3092\u7528\u610f\u3057\u307e\u3059\u3002\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p>\u25bcroot\/packages\/common\/types\/user.ts<\/p>\n<pre>\nexport type UserType = {\n  id: number;\n  name: string;\n  email: string;\n};\n<\/pre>\n<p>root\/packages\/common\/functions\u306b\u306f\u3001getHello.ts\u3092\u7528\u610f\u3057\u307e\u3059\u3002\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\n\u306a\u3093\u3066\u3053\u3068\u306f\u306a\u3044\u3002\u305f\u3060\u300cHello!!\u300d\u3092\u8fd4\u3059\u3060\u3051\u306e\u95a2\u6570\u3067\u3059\u306d\u3002<\/p>\n<p>\u25bcroot\/packages\/common\/functions\/getHello.ts<\/p>\n<pre>\nexport const getHello = () => 'Hello!!';\n<\/pre>\n<h3>\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306epackage.json\u306bprivate\/workspace\u3092\u8ffd\u52a0<\/h3>\n<p>\u3053\u3053\u307e\u3067\u6765\u307e\u3057\u305f\u3089\u3001\u4e00\u5ea6root\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u623b\u308a\u307e\u3057\u3087\u3046\u3002<br \/>\n\u305d\u3057\u3066\u3001root\u76f4\u4e0b\u306epackage.json\u306b\u9805\u76ee\u3092\u8ffd\u8a18\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u25bcroot\/package.json<\/p>\n<pre>\n{\n  \"name\": \"root\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"private\": true, \/\/ \u2190\u8ffd\u52a0\n  \"workspaces\": { \/\/ \u2190\u8ffd\u52a0\n    \"packages\": [\n      \"packages\/*\"\n    ]\n  }\n}\n<\/pre>\n<p>\u8ffd\u52a0\u3057\u305f\u9805\u76ee\u306f\u3001<strong>private<\/strong>\u3068<strong>workspaces<\/strong>\u3067\u3059\u3002<br \/>\nyarn workspace \u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u76f4\u4e0b\u306epackage.json\u306b\u5fc5\u9808\u3067\u8a18\u8ff0\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><strong>private\u306f\u5fc5\u305atrue\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/strong><br \/>\n<strong>workspaces\u306b\u306f\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3068\u3059\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/strong><br \/>\n\u4eca\u56de\u306e\u5834\u5408\u306f\u3001packages\/client01\u3001packages\/client02\u3001packages\/server\u3092\u76f4\u63a5\u6307\u5b9a\u3057\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u2026\u3001<br \/>\nworkspaces\u306f\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u304c\u4f7f\u7528\u3067\u304d\u308b\u305f\u3081\u3001&#8221;packages&#8221;: [ &#8220;packages\/*&#8221; ] \u3068\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3067\u3001packages\u914d\u4e0b\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3068\u3057\u3066\u6271\u308f\u308c\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001workspaces\u306b\u306f\u3001packages\u306e\u4ed6\u306bnohoist\u3082\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<br \/>\nnohoist\u306b\u6307\u5b9a\u3057\u305fnode\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3054\u3068\u306b\u500b\u5225\u3067\u7ba1\u7406\u3055\u308c\u307e\u3059\u3002<br \/>\nnohoist\u304c\u306a\u3044\u3001\u3082\u3057\u304f\u306fnode\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u6307\u5b9a\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3067node\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u5171\u6709\u5316\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\uff08client01\/client02\uff09\u3092\u6574\u5099<\/h3>\n<p>\u4eca\u5ea6\u306f\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b92\u3064\u5206\u3092\u8abf\u6574\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001next.config.js\u306e\u5185\u5bb9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n\u3084\u3063\u3066\u3044\u308b\u4e8b\u306f\u3001next.js\u5185\u3067\u4f7f\u7528\u3059\u308b\u30d1\u30b9\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u306e\u6307\u5b9a\u3067\u3059\u3002<br \/>\n\u300c^@\u300d\u3067root\/packages\/common\/\u914d\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u53c2\u7167\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u25bcroot\/packages\/client01\/next.config.js\u30fbroot\/packages\/client02\/next.config.js<\/p>\n<pre>\nconst path = require('path')\n\n\/** @type {import('next').NextConfig} *\/\nmodule.exports = {\n  webpack: (config) => {\n    config.resolve.alias['^@'] = path.resolve(__dirname, '..\/common')\n    return config\n  },\n  reactStrictMode: true,\n}\n<\/pre>\n<p>tsconfig.json\u306b<strong>baseUrl\u3001paths<\/strong>\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<br \/>\n\u8ffd\u8a18\u3057\u305f\u5185\u5bb9\u306f\u3001next.config.js\u3068\u540c\u69d8\u3067\u3001\u30d1\u30b9\u30a8\u30a4\u30ea\u30a2\u30b9\u306e\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<p>\u25bcroot\/packages\/client01\/tsconfig.json\u30fbroot\/packages\/client02\/tsconfig.json<\/p>\n<pre>\n{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"noEmit\": true,\n    \"esModuleInterop\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"jsx\": \"preserve\",\n    \"incremental\": true,\n    \"baseUrl\": \".\/\", \/\/ \u2190 \u8ffd\u8a18\n    \"paths\": {  \/\/ \u2190 \u8ffd\u8a18\n      \"^@\/*\": [\"..\/common\/*\"]\n    }\n  },\n  \"include\": [\"next-env.d.ts\", \"**\/*.ts\", \"**\/*.tsx\"],\n  \"exclude\": [\"node_modules\"]\n}\n<\/pre>\n<p>\u6b21\u306b\u3001root\/packages\/client01\/pages\/index.tsx\u3068root\/packages\/client02\/pages\/index.tsx\u3092\u7de8\u96c6\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\nNext.js\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u305f\u6642\u306b\u3001\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u30da\u30fc\u30b8\u3067\u3059\u306d\u3002<\/p>\n<p>\u25bcroot\/packages\/client01\/pages\/index.tsx<\/p>\n<pre>\nimport { useEffect, useState } from 'react';\nimport type { NextPage } from 'next';\nimport styles from '..\/styles\/Home.module.css';\n\/\/ functions\nimport { getHello } from '^@\/functions\/getHello'; \/\/ \u2190 common\/functions\u304b\u3089getHello\u3092import\n\/\/ types\nimport { UserType } from '^@\/types\/user'; \/\/  \u2190 common\/types\u304b\u3089UserType\u3092import\n\nconst Home: NextPage = () => {\n  const [users, setUsers] = useState<UserType[]>([]);\n\n  useEffect(() => {  \/\/  \u2190 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3068\u9023\u643a\u3059\u308b\n    fetch('http:\/\/localhost:4000\/')\n      .then(async (response) => {\n        const users: UserType[] = await response.json();\n        setUsers(users);\n      })\n      .catch((error) => {\n        console.log('error: ', error);\n      });\n  }, []);\n\n  return (\n    <div className={styles.container}>\n      <h1>{getHello()} This is client02.<\/h1>\n      <ul>\n        {users.length > 0 &&\n          users.map((user) => {\n            return (\n              <li key={user.id}>\n                \n                  id: {user.id} | name: {user.name} | email: {user.email}\n                \n              <\/li>\n            );\n          })}\n      <\/ul>\n    <\/div>\n  );\n};\n\nexport default Home;\n<\/pre>\n<p>\u5148\u7a0b\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u306enext.config.js\u3068tsconfig.json\u3092\u8abf\u6574\u3057\u305f\u304a\u304b\u3052\u3067\u3001common\u914d\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092import\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001import\u6587\u3067\u547c\u3073\u51fa\u3057\u3066\u3001\u30da\u30fc\u30b8\u5185\u3067\u4f7f\u3063\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<pre>\nimport { getHello } from '^@\/functions\/getHello';\nimport { UserType } from '^@\/types\/user';\n<\/pre>\n<p>\u307e\u305f\u3001useEffect\u3092\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u3082\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u306d\u3002<br \/>\n\u3053\u306e\u90e8\u5206\u306f\u5f8c\u307b\u3069\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n<pre>\n  useEffect(() => {  \/\/  \u2190 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3068\u9023\u643a\u3059\u308b\n    fetch('http:\/\/localhost:4000\/')\n      .then(async (response) => {\n        const users: UserType[] = await response.json();\n        setUsers(users);\n      })\n      .catch((error) => {\n        console.log('error: ', error);\n      });\n  }, []);\n<\/pre>\n<p>root\/packages\/client02\/pages\/index.tsx\u3082\u540c\u69d8\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n\u5185\u5bb9\u306f\u307b\u307c\u4e00\u7dd2\u3067\u3059\u304c\u3001client01\u3068\u306e\u9055\u3044\u304c\u308f\u304b\u308b\u3088\u3046\u306b\u3001h1\u306e\u4e2d\u8eab\u3092\u300c{getHello()} This is client0<strong>2<\/strong>.\u300d\u3068\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u25bcroot\/packages\/client02\/pages\/index.tsx<\/p>\n<pre>\nimport { useEffect, useState } from 'react';\nimport type { NextPage } from 'next';\nimport styles from '..\/styles\/Home.module.css';\n\/\/ functions\nimport { getHello } from '^@\/functions\/getHello';\n\/\/ types\nimport { UserType } from '^@\/types\/user';\n\nconst Home: NextPage = () => {\n  const [users, setUsers] = useState<UserType[]>([]);\n\n  useEffect(() => {\n    fetch('http:\/\/localhost:4000\/')\n      .then(async (response) => {\n        const users: UserType[] = await response.json();\n        setUsers(users);\n      })\n      .catch((error) => {\n        console.log('error: ', error);\n      });\n  }, []);\n\n  return (\n    <div className={styles.container}>\n      <h1>{getHello()} This is client02.<\/h1>\n      <ul>\n        {users.length > 0 &&\n          users.map((user) => {\n            return (\n              <li key={user.id}>\n                \n                  id: {user.id} | name: {user.name} | email: {user.email}\n                \n              <\/li>\n            );\n          })}\n      <\/ul>\n    <\/div>\n  );\n};\n\nexport default Home;\n<\/pre>\n<p>\u3053\u308c\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306e\u8abf\u6574\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h3>\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\uff08server\uff09\u3092\u6574\u5099<\/h3>\n<p>\u6b21\u306b\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3092\u8abf\u6574\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305a\u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092root\u306b\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001root\/packages\/server\u306bnode\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre>\nyarn workspace server add @types\/express @types\/node express ts-node typescript\n<\/pre>\n<p>\n&nbsp;<br \/>\n<\/p>\n<p>yarn workspace \u3092\u4f7f\u3046\u5834\u5408\u3001\u30b3\u30de\u30f3\u30c9\u306e\u5f62\u5f0f\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\uff08server\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\uff09\u306b\u3001Express\u3092\u306f\u3058\u3081\u3068\u3057\u305fnode\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u306b\u306a\u3063\u305f\u308f\u3051\u3067\u3059\u3002<\/p>\n<pre>\nyarn workspace <workspace\u540d> <\u30b3\u30de\u30f3\u30c9\u540d> <\u5f15\u6570\u2026>\n<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3078\u4f55\u304b\u306enode\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u8ffd\u52a0\u3057\u305f\u3044\u30fb\u524a\u9664\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u25bcclient01\u3078node\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u8ffd\u52a0<\/p>\n<pre>\nyarn workspace client01 add hoge-module\n<\/pre>\n<p>\u25bcclient01\u306enode\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u524a\u9664<\/p>\n<pre>\nyarn workspace client01 remove fuga-module\n<\/pre>\n<p>\n&nbsp;<br \/>\n<\/p>\n<p>\u3055\u3066\u3001node\u30e2\u30b8\u30e5\u30fc\u30eb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3089\u3001\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u6574\u5099\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n\u307e\u305atsconfig.json\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\nsrc\u306bTypeScript\u30d5\u30a1\u30a4\u30eb\u3092\u914d\u7f6e\u3059\u308b\u306e\u3067\u3001include\u306f\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u8a18\u8ff0\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u25bcroot\/packages\/server\/tsconfig.json<\/p>\n<pre>\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2019\",\n    \"module\": \"commonjs\",\n    \"sourceMap\": true,\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true\n  },\n  \"include\": [\"src\/**\/*\"]\n}\n<\/pre>\n<p>\u6b21\u306b\u3001server\u76f4\u4e0b\u306bsrc\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u4e2d\u306bmain.ts\u3092\u683c\u7d0d\u3057\u307e\u3057\u3057\u3087\u3046\u3002<br \/>\n\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p>\u25bcroot\/packages\/server\/src\/main.ts<\/p>\n<pre>\n\/\/ module\nimport express from 'express';\n\/\/ const\nconst port = 4000;\n\/\/ types\nimport { UserType } from '..\/..\/common\/types\/user';\n\/\/ functions\nimport { getHello } from '..\/..\/common\/functions\/getHello';\n\n\/\/ user\nconst users: UserType[] = [\n  { id: 1, name: 'hoge', email: 'hoge@test.co.jp' },\n  { id: 2, name: 'fuga', email: 'fuga@test.co.jp' },\n  { id: 3, name: 'piyo', email: 'piyo@test.co.jp' },\n];\n\n\/\/ express\nconst app: express.Express = express();\napp.use((req: express.Request, res: express.Response, next: express.NextFunction) => {\n  res.header('Access-Control-Allow-Origin', '*');\n  next();\n});\n\n\/\/ \u30e6\u30fc\u30b6\u30fc\u3092\u8fd4\u3059\napp.get('\/', (req: express.Request, res: express.Response) => {\n  res.send(users);\n});\n\n\/\/ start\napp.listen(port, () => {\n  console.log(`${getHello()} port: ${port}.`);\n});\n<\/pre>\n<p>root\/packages\/server\/src\/main.ts \u3067\u3084\u3063\u3066\u3044\u308b\u4e8b\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002<br \/>\nexpress\u3092\u4f7f\u3063\u3066\u3001http:\/\/localhost:4000\/\u3078GET\u3067\u53e9\u304f\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u3092\u8fd4\u3059\u3060\u3051\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p>\u5148\u7a0b\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306eindex.tsx\u3067\u5f8c\u307b\u3069\u89e3\u8aac\u3059\u308b\u3068\u8a00\u3063\u3066\u3044\u305f\u70b9\u304c\u3053\u3053\u3067\u3059\u3002<br \/>\n\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3067\u306f\u3001http:\/\/localhost:4000\/\uff08GET\uff09\u3067\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u3092\u8fd4\u3059\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u3067\u306f\u3001useEffect\u3092\u4f7f\u3063\u3066\u521d\u671f\u8868\u793a\u6642\u306b\u3001http:\/\/localhost:4000\/\u3092\u53e9\u3044\u3066\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u3092\u53d6\u5f97\u3057\u3066\u3001\u30da\u30fc\u30b8\u306b\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\n&nbsp;<br \/>\n<\/p>\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u540c\u69d8\u3001packages\/common\u304b\u3089\u3001UserType\u30fbgetHello\u3092import\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3067\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\u3068\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3067\u30b3\u30fc\u30c9\u306e\u5171\u6709\u5316\u304c\u3067\u304d\u307e\u3057\u305f\u306d\u3002<\/p>\n<p>\u3055\u3066\u3001\u6b21\u306f\u3001server\u76f4\u4e0b\u306epackage.json\u3092\u7de8\u96c6\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001scripts\u3092\u5165\u308c\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u25bcroot\/packages\/server\/package.json<\/p>\n<pre>\n{\n  \"name\": \"server\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"@types\/express\": \"^4.17.13\",\n    \"@types\/node\": \"^16.11.7\",\n    \"express\": \"^4.17.1\",\n    \"ts-node\": \"^10.4.0\",\n    \"typescript\": \"^4.4.4\"\n  },\n  \"scripts\": { \u2190 \/\/ \u8ffd\u8a18\n    \"dev\": \"npx ts-node .\/src\/main.ts\"\n  }\n}\n<\/pre>\n<h3>\u30eb\u30fc\u30c8\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306epackage.json\u306bscript\u3092\u8ffd\u52a0<\/h3>\n<p>\u3042\u3068\u3082\u3046\u3061\u3087\u3063\u3068\u3067\u3059\u3002<br \/>\n\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u76f4\u4e0b\u306epackage.json\u306bscripts\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<p>\u25bcroot\/package.json<\/p>\n<pre>\n{\n  \"name\": \"root\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"private\": true,\n  \"scripts\": { \/\/ \u2190\u8ffd\u8a18\n    \"cl01:dev\": \"yarn workspace client01 dev\",\n    \"cl02:dev\": \"yarn workspace client02 dev\",\n    \"se:dev\": \"yarn workspace server dev\"\n  },\n  \"workspaces\": {\n    \"packages\": [\n      \"packages\/*\"\n    ]\n  }\n}\n<\/pre>\n<p>\u5148\u7a0b\u3001\u30c1\u30e9\u30c3\u3068\u89e3\u8aac\u3057\u307e\u3057\u305f\u304c\u3001yarn workspace \u3092\u4f7f\u3063\u305f\u6642\u306e\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>\nyarn workspace <workspace\u540d> <\u30b3\u30de\u30f3\u30c9\u540d> <\u5f15\u6570\u2026>\n<\/pre>\n<p>\u3067\u3059\u306e\u3067\u2026\u3001<br \/>\nyarn workspace client01 dev\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001packages\/client01\u306eNext.js\u306edev\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br \/>\n\u540c\u3058\u3088\u3046\u306b\u3001yarn workspace client02 dev\u306f\u3001packages\/client02\u306eNext.js\u306edev\u30b3\u30de\u30f3\u30c9\u304c\u3002<br \/>\nyarn workspace server dev\u306f\u3001packages\/server\u306edev\u30b3\u30de\u30f3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u30b3\u30de\u30f3\u30c9\u3092\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306epackage.json\u306b\u767b\u9332\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9\uff08\u305d\u306e1\uff09\u306edev\u3092\u5b9f\u884c\u3057\u305f\u3044\u306a\u3089\u3001<strong>yarn cl01:dev<\/strong>\u3002<br \/>\n\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306edev\u3092\u5b9f\u884c\u3057\u305f\u3044\u306a\u3089\u3001<strong>yarn se:dev<\/strong>\u3092\u4f7f\u3048\u3070OK\u3067\u3059\u3002<\/p>\n<h3>\u6700\u7d42\u8abf\u6574\u3092\u3057\u3066\u5b8c\u6210<\/h3>\n<p>\u3055\u3066\u3001\u3053\u3053\u307e\u3067\u304f\u308c\u3070\u5b8c\u6210\uff01\u2026\u3068\u8a00\u3044\u305f\u3044\u306e\u3067\u3059\u304c\u3001<br \/>\n<strong>\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306epackage.json\u306b\u8db3\u308a\u306a\u3044\u9805\u76ee\u304c\u3042\u308b\u3068\u3001yarn workspace\u30b3\u30de\u30f3\u30c9\u304c\u3046\u307e\u304f\u5b9f\u884c\u3055\u308c\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><\/p>\n<p>\u79c1\u304c\u74b0\u5883\u69cb\u7bc9\u3057\u305f\u969b\u306f\u3001<strong>\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306epackage.json\u306b\u300cversion\u300d\u304c\u306a\u3044\u305f\u3081\u306b\u3001yarn workspace\u30b3\u30de\u30f3\u30c9\u304c\u3046\u307e\u304f\u52d5\u4f5c\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/strong><\/p>\n<p>\u307e\u305f\u3001<strong>package.json\u306e\u300cname\u300d\u3082\u91cd\u8981\u306a\u9805\u76ee<\/strong>\u3067\u3059\u3002<br \/>\n\u3053\u3053\u307e\u3067\u89e6\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u5b9f\u306f<strong>package.json\u306ename\u306f\u3001yarn workspace\u30b3\u30de\u30f3\u30c9\u306eworkspace\u540d\u3068\u4e00\u81f4\u3055\u305b\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><br \/>\n\u3067\u306a\u3044\u3068\u3001yarn workspace\u30b3\u30de\u30f3\u30c9\u304c\u3046\u307e\u304f\u52d5\u4f5c\u3057\u307e\u305b\u3093\u3002<\/p>\n<p>\u4ed6\u306b\u3082\u3044\u308d\u3044\u308d\u3042\u308a\u305d\u3046\u3067\u3059\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u2026\u3001<br \/>\n<strong>\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306epackage.json\u306bWARNING\u304c\u51fa\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u3002<\/strong><br \/>\n<strong>\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306epackage.json\u306ename\u306f\u3001yarn workspace\u30b3\u30de\u30f3\u30c9\u306eworkspace\u540d\u3068\u4e00\u81f4\u3055\u305b\u308b\u3002<\/strong><br \/>\n\u2026\u306e2\u3064\u3092\u30af\u30ea\u30a2\u3057\u3066\u3044\u308c\u3070\u554f\u984c\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e00\u5ea6\u3001\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306epackage.json\u3092\u898b\u76f4\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\n&nbsp;<br \/>\n<\/p>\n<p>\u6700\u7d42\u8abf\u6574\u304c\u7d42\u308f\u308a\u307e\u3057\u305f\u3089\u3001\u3053\u308c\u3067\u30e2\u30ce\u30ec\u30dd\u74b0\u5883\u4f5c\u6210\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\uff01<br \/>\n\u304a\u75b2\u308c\u3055\u307e\u3067\u3057\u305f\u3002<\/p>\n<p>\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u30ab\u30ec\u30f3\u30c8\u3068\u3057\u3066\u3001yarn cl01:dev\u3068yarn se:dev\u306e\u30b3\u30de\u30f3\u30c92\u3064\u5206\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u305d\u306e\u4e0a\u3067\u3001http:\/\/localhost:3000\/\u3092\u958b\u304f\u3068\u3001\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u304b\u3089\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u8fd4\u3055\u308c\u3001\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u304c\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001yarn cl02:dev\u3067\u3082\u540c\u3058\u3088\u3046\u306b\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\n&nbsp;<br \/>\n<\/p>\n<p>\u3053\u306e\u3088\u3046\u306byarn workspace\u3092\u4f7f\u3046\u3068\u3001\u30e2\u30ce\u30ec\u30dd\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u5404\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3067\u7c21\u5358\u306b\u30b3\u30fc\u30c9\u3092\u5171\u6709\u3067\u304d\u307e\u3059\u306e\u3067\u3001\u5927\u5909\u4fbf\u5229\u306a\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3053\u3053\u307e\u3067\u3002<br \/>\n\u3067\u306f\u3001\u307e\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002 \u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u8fbb\u3067\u3059\u3002 \u4eca\u56de\u306f\u30bf\u30a4\u30c8\u30eb\u901a\u308a\u3001yarn workspace\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002 \u3068\u3066\u3082\u826f\u3044\u6a5f\u80fd\u3067\u3057\u305f\u306e\u3067\u3001\u5099\u5fd8\u9332\u3092\u517c\u306d\u3066\u30d6\u30ed\u30b0\u306b\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002 yarn workspace\u3068\u306f\uff1f yarn w&#8230;<\/p>\n","protected":false},"author":5,"featured_media":6323,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[49],"_links":{"self":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/6318"}],"collection":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=6318"}],"version-history":[{"count":89,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/6318\/revisions"}],"predecessor-version":[{"id":6411,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/6318\/revisions\/6411"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media\/6323"}],"wp:attachment":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=6318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=6318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=6318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}