Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vercel monorepo対策 / Vercel monorepo

2bedb1eb8f841cd3c3ae584600b016e0?s=47 OKUNOKENTARO
September 19, 2021

Vercel monorepo対策 / Vercel monorepo

2021年9月19日の発表で使用した資料です。

2bedb1eb8f841cd3c3ae584600b016e0?s=128

OKUNOKENTARO

September 19, 2021
Tweet

Transcript

  1. 7FSDFMNPOPSFQPରࡦ 4FQ *SJT-5ձ !PLVOPLFOUBSP

  2. ୭ w Ԟ໺ݡଠ࿠!PLVOPLFOUBSP w ΫϨε΢ΣΞגࣜձࣾ w .S໰୊ղܾ w 5ZQF4DSJQUϑϩϯ τΤϯ

    υ ɾ όοΫΤϯ υ
  3. .POPSFQP w Ϟϊ Ϩϙ w NPOP઀಄ࣙ ʢϞϊΫϩɺ Ϟϊϩʔάɺ ϞϊϙϦʔʜʣ 

    w ͻͱͭͷ3FQPTJUPSZͰෳ਺ͷύοέʔδΛ؅ཧ͢Δ͜ͱ w ਖ਼௚࿩ऀʹΑͬͯࢦͯ͠Δཻ౓͕ҧ͏ w ྫ ɿ ϝϧΧϦ4IPQTͷϞϊ Ϩϙ w ྫ ɿ OQNͰͷ044ʹ͓͚ΔϞϊ Ϩϙ
  4. 7FSDFMʹ͓͚ΔϞϊ Ϩϙ w 7FSDFMʹ͸Oݸͷ/FYUKTΞϓϦέʔγϣϯΛσϓϩΠͰ͖Δ w IUUQTWFSDFMDPNCMPHNPOPSFQPT w ͦͷ·Μ·ͳ໊લͷهࣄ͕͋Δ w Ұݟ͜ͷ·Μ·΍Ε͹ɺ

    ໰୊ͳ͍͚ͦ͘͏
  5. Α ͘ ͋Δڞ௨Խ໰୊ w 3FQPʹ"QQ" "QQ#͕͋ͬͨͱͯ͠ɺ  w "ͱ#ͷڞ௨ίʔ υ͸Ͳ͏͢Δ

    ʁ  w ྫ͑͹ϩάΠϯॲཧ͸ɺ ؀ڥม਺ͷҧ͍͚ͩͰ࢒Γͷϑϩʔ͸͢΂ͯҰॹ w ؀ڥม਺͚ͩҾ਺Խͯ͠ɺ ͋ͱ͸ؔ਺ʹ͍ͨ͠ w Ͳ͜ʹஔ͘ ʁ
  6. 6OJWFSTBMσΟ ϨΫ τ Ϧ w "QQ" "QQ#ͱܑఋͷσΟ ϨΫ τ Ϧ

    ͱͯ͠VOJWFSTBMΛஔ͘ w ./app-a ./app-b ./universalΈ͍ͨʹͳΔ w ൵͍͜͠ͱʹ͜Ε͸·ͬͨ͘ಈ͔ͳ͍ w 8FCQBDL͸ΞϓϦέʔγϣϯͷϧʔ τΑ Γ਌Λࢀর͢Δ͜ͱ͕Ͱ͖ͳ͍ w DPO fi HͰରࡦ͢Δ
  7. OFYUDPO fi HKT module.exports = { webpack: (config) => {

    const tsRule = config.module.rules.find((v) => v.test ? . toString().includes("ts") ); // app ΑΓ্ͷσΟϨΫτϦʹ͋Δ universal Λऔಘ͢ΔͨΊʹઃఆ const projectRoot = path .parse( __ filename) .dir.split(path.sep) .slice(0, -1) .join(path.sep); tsRule.include.push(projectRoot); return config; }, };
  8. ͜Ε͚ͩ͡Ό·ͩͩΊ w ϩʔΧϧͰ͸ϏϧυͰ͖Δ w 7FSDFMଆͰ͸·ͩϏϧυࣦഊ͢Δ w ͳͥͳΒ7FSDFMͷεΫ Ϧ ϓτͰ͸ΞϓϦέʔγϣϯϧʔ τ͔͠

    
 npm iͯ͘͠Εͳ͍ w VOJWFSTBMͰ࢖͏ ϥΠ ϒϥ Ϧ͸ಡΈࠐ·ΕͣΤϥʔͱͳΔ
  9. *OTUBMM$PNNBOE্ॻ͖ w *OTUBMM$PNNBOEΛ্ॻ͖ͯ͠ɺ 
 ͦ͜Ͱ਌ͷnpm iΛ࣮ߦ͢Δ w OQNͷόʔδϣϯ͕ 
 ἧΘͳ͍ͱ͖͸ɺ

    ͜͜ͰڧҾʹ͍ΕΔ
  10. 5IBOLZPV