{"id":1591,"date":"2025-08-11T15:48:29","date_gmt":"2025-08-11T06:48:29","guid":{"rendered":"https:\/\/beeknowledge.co.jp\/?p=1591"},"modified":"2025-08-11T15:48:51","modified_gmt":"2025-08-11T06:48:51","slug":"windows-%e3%81%a7%e3%81%ae-pwa-%e9%96%8b%e7%99%ba%e7%92%b0%e5%a2%83%e3%82%bb%e3%83%83%e3%83%88%e3%82%a2%e3%83%83%e3%83%97%ef%bc%88wsl2-node-lts-pnpm-vite-vite-plugin-pwa%e3%80%81laravel-api","status":"publish","type":"post","link":"https:\/\/beeknowledge.co.jp\/?p=1591","title":{"rendered":"Windows \u3067\u306e PWA \u958b\u767a\u74b0\u5883\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\uff08WSL2 + Node LTS + pnpm + Vite + vite-plugin-pwa\u3001Laravel API \u9023\u643a\uff09"},"content":{"rendered":"\n<!doctype html>\n<html lang=\"ja\">\n<head>\n<meta charset=\"utf-8\" \/>\n<title>Windows \u3067\u306e PWA \u958b\u767a\u74b0\u5883\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\uff08WSL2 + Node + pnpm + Vite + Laravel \u9023\u643a\uff09<\/title>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" \/>\n<style>\n  body{font-family:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Hiragino Kaku Gothic ProN\", \"Noto Sans JP\", Meiryo, sans-serif; line-height:1.7; color:#222; max-width:980px; margin:40px auto; padding:0 16px;}\n  code,kbd,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, \"Liberation Mono\", \"Noto Sans Mono\", monospace;}\n  pre{background:#0f172a; color:#e2e8f0; padding:14px 16px; border-radius:10px; overflow:auto;}\n  h1,h2,h3{line-height:1.35}\n  h1{margin-top:0}\n  .ok{color:#10b981}\n  .warn{color:#f59e0b}\n  .bad{color:#ef4444}\n  table{border-collapse:collapse; width:100%}\n  th,td{border:1px solid #e5e7eb; padding:8px 10px; vertical-align:top}\n  th{background:#f8fafc; text-align:left}\n  .small{font-size:0.92em; color:#555}\n<\/style>\n<\/head>\n<body>\n\n\n<p>\u3053\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u3001\u3053\u308c\u307e\u3067\u5b9f\u65bd\u3057\u305f Windows \u5074\u306e\u74b0\u5883\u8a2d\u5b9a\u3092 <strong>\u518d\u73fe\u6027\u306e\u3042\u308b\u624b\u9806<\/strong>\u3068\u3057\u3066\u6574\u7406\u3057\u305f\u3082\u306e\u3067\u3059\u3002\u30b4\u30fc\u30eb\u306f <strong>\u300cReact\/TypeScript \u306e PWA \u3092 Windows \u4e0a\u3067\u5feb\u9069\u306b\u958b\u767a\u3057\u3001Laravel API \u3068\u9023\u643a\u3059\u308b\u300d<\/strong>\u3053\u3068\u3002WSL2 \u3092\u4f7f\u3044\u3001\u30d5\u30ed\u30f3\u30c8\u306f Vite\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u306f pnpm\u3001PWA \u306f <code>vite-plugin-pwa<\/code> \u3067\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/p>\n\n<hr>\n<h2>0. PWA\u3068\u306f<\/h2>\n<p><strong>PWA\uff08Progressive Web App\uff09<\/strong>\u306f\u3001Web\u6280\u8853\uff08HTML\/CSS\/JS\uff09\u3067\u4f5c\u308b<strong>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u53ef\u80fd\u306a\u30a2\u30d7\u30ea<\/strong>\u3067\u3059\u3002URL\u3067\u958b\u3051\u308b\u901a\u5e38\u306eWeb\u3068\u540c\u3058\u914d\u5e03\u6027\u3092\u4fdd\u3061\u3064\u3064\u3001<strong>\u30db\u30fc\u30e0\u753b\u9762\u30a2\u30a4\u30b3\u30f3<\/strong>\u30fb<strong>\u5168\u753b\u9762\u8868\u793a<\/strong>\u30fb<strong>\u30aa\u30d5\u30e9\u30a4\u30f3\u52d5\u4f5c<\/strong>\u30fb<strong>\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\uff08\u5bfe\u5fdc\u74b0\u5883\uff09<\/strong>\u306a\u3069\u3001\u30cd\u30a4\u30c6\u30a3\u30d6\u306b\u8fd1\u3044\u4f53\u9a13\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u4e2d\u6838\u306f\u4ee5\u4e0b\u306e3\u8981\u7d20\u3067\u3059\u3002<\/p>\n<ul>\n  <li><strong>Service Worker<\/strong>\uff1a\u30d6\u30e9\u30a6\u30b6\u306e\u88cf\u65b9\u3067\u52d5\u304f\u30b9\u30af\u30ea\u30d7\u30c8\u3002\u30ea\u30bd\u30fc\u30b9\u3084API\u5fdc\u7b54\u306e<strong>\u30ad\u30e3\u30c3\u30b7\u30e5<\/strong>\u3001<strong>\u30aa\u30d5\u30e9\u30a4\u30f3<\/strong>\u3001<strong>\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u540c\u671f\uff08\u9650\u5b9a\uff09<\/strong>\u3092\u62c5\u5f53\u3002<\/li>\n  <li><strong>Web App Manifest<\/strong>\uff1a\u30a2\u30d7\u30ea\u540d\u3001\u30a2\u30a4\u30b3\u30f3\u3001\u30c6\u30fc\u30de\u8272\u3001\u8d77\u52d5\u30e2\u30fc\u30c9\uff08standalone\uff09\u306a\u3069\u306e\u30e1\u30bf\u60c5\u5831\u3002\u3053\u308c\u304c\u3042\u308b\u3068\u300c\u30db\u30fc\u30e0\u753b\u9762\u306b\u8ffd\u52a0\u300d\u7b49\u304c\u6709\u52b9\u306b\u3002<\/li>\n  <li><strong>HTTPS<\/strong>\uff1aSW\u3084\u591a\u304f\u306e\u30c7\u30d0\u30a4\u30b9API\u306f<strong>\u5b89\u5168\u306a\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8<\/strong>\u304c\u5fc5\u9808\u3002\u958b\u767a\u6642\u306e <code>http:\/\/localhost<\/code> \u306f\u4f8b\u5916\u7684\u306b\u5b89\u5168\u6271\u3044\u3002<\/li>\n<\/ul>\n<p><strong>\u3067\u304d\u308b\u3053\u3068<\/strong>\uff1a\u30aa\u30d5\u30e9\u30a4\u30f3\u95b2\u89a7\u30fb\u30d5\u30a9\u30fc\u30e0\uff0f\u30ad\u30e5\u30fc\u306e\u30ed\u30fc\u30ab\u30eb\u4fdd\u5b58\uff08IndexedDB\uff09\u30fb\u30ab\u30e1\u30e9\uff0f\u30de\u30a4\u30af\uff0f\u4f4d\u7f6e\u60c5\u5831\u30fbWebGPU\/WebGL\/WASM\u3067\u306e\u7aef\u672b\u5185\u63a8\u8ad6\u30fbWeb Share\u30fbAndroid\u3067\u306eWeb Push \u7b49\u3002<\/p>\n<p><strong>\u5f31\u3044\u3068\u3053\u308d<\/strong>\uff1aiOS\u306e\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u5236\u9650\u3001\u9577\u6642\u9593\u306e\u5e38\u99d0\u51e6\u7406\u4e0d\u53ef\u3001\u7d30\u7c92\u5ea6\u306e\u30cf\u30fc\u30c9\u5236\u5fa1\uff08ISO\/\u9732\u51fa\u306a\u3069\uff09\u306f\u4e0d\u53ef\u3002<br>\n\u7d50\u8ad6\u3068\u3057\u3066\u3001\u4eca\u56de\u306e<strong>\u52d5\u753b\uff0bGPX\u306e\u5927\u5bb9\u91cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\uff0f\u30aa\u30d5\u30e9\u30a4\u30f3\u4e00\u6642\u4fdd\u5b58\uff0f\u518d\u9001<\/strong>\u3068\u3044\u3046\u8981\u4ef6\u306bPWA\u306f\u9069\u5408\u3057\u307e\u3059\u3002\u91cd\u3044\u63a8\u8ad6\u306f\u30b5\u30fc\u30d0\u5074\uff08Laravel\u2192Python\uff09\u306b\u56de\u3057\u3001\u7aef\u672b\u5074\u306f\u524d\u51e6\u7406\u3084UI\u306b\u6ce8\u529b\u3059\u308b\u69cb\u6210\u304c\u5805\u7262\u3067\u3059\u3002<\/p>\n\n<hr>\n<h2>1. \u30b4\u30fc\u30eb\u3068\u69cb\u6210<\/h2>\n<ul>\n  <li><strong>WSL2 (Ubuntu)<\/strong> \u4e0a\u3067 Node LTS + pnpm \u3092\u5229\u7528\u3057\u3066\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092\u958b\u767a<\/li>\n  <li><strong>Vite + React\/TypeScript<\/strong> \u3067 PWA \u96db\u5f62\u3092\u4f5c\u6210\u3001<code>vite-plugin-pwa<\/code> \u3067 SW\/Manifest \u3092\u81ea\u52d5\u751f\u6210<\/li>\n  <li>\u958b\u767a\u4e2d\u306f <strong>http:\/\/localhost:5173<\/strong>\uff08\u5b89\u5168\u306a\u30ed\u30fc\u30ab\u30eb\uff09\u3067 SW \u304c\u52d5\u4f5c\u3001Laravel API \u306f <code>\/api<\/code> \u30d7\u30ed\u30ad\u30b7<\/li>\n  <li>Android \u5b9f\u6a5f\u306f <code>adb reverse<\/code> \u3067\u30ed\u30fc\u30ab\u30eb\u306b\u63a5\u7d9a\u3057\u3001PWA \u3092\u30db\u30fc\u30e0\u8ffd\u52a0\u3057\u3066\u691c\u8a3c<\/li>\n<\/ul>\n\n<hr>\n\n<h2>2. \u524d\u63d0\u6761\u4ef6\u3068\u7ba1\u7406\u8005\u6a29\u9650\u306e\u6271\u3044<\/h2>\n<p>\u57fa\u672c\u30b9\u30bf\u30f3\u30b9\u306f <strong>\u300c\u666e\u6bb5\u306f\u4e00\u822c\u30e6\u30fc\u30b6\u6a29\u9650\u3001\u521d\u56de\u306e OS \u8a2d\u5b9a\u3060\u3051\u7ba1\u7406\u8005\u300d<\/strong>\u3067\u3059\u3002<\/p>\n\n<table>\n  <thead><tr><th>\u7ba1\u7406\u8005\u304c\u5fc5\u8981<\/th><th>\u7ba1\u7406\u8005\u4e0d\u8981<\/th><\/tr><\/thead>\n  <tbody>\n    <tr><td>WSL \/ \u4eee\u60f3\u5316\u6a5f\u80fd\u306e\u6709\u52b9\u5316\uff08DISM\uff09<\/td><td>Vite \u958b\u767a\u30b5\u30fc\u30d0\u8d77\u52d5\u3001\u30b3\u30fc\u30c9\u7de8\u96c6<\/td><\/tr>\n    <tr><td><code>mkcert -install<\/code> \u3067\u8a3c\u660e\u66f8\u3092\u4fe1\u983c\u30b9\u30c8\u30a2\u306b\u767b\u9332\uff08\u4efb\u610f\uff09<\/td><td>pnpm \u3067\u306e\u4f9d\u5b58\u89e3\u6c7a\u3084\u30d3\u30eb\u30c9<\/td><\/tr>\n    <tr><td>Chocolatey \u7b49\u306e\u30b7\u30b9\u30c6\u30e0\u7bc4\u56f2\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/td><td>Service Worker \u306e\u767b\u9332\uff08localhost \u306f\u5b89\u5168\u6271\u3044\uff09<\/td><\/tr>\n  <\/tbody>\n<\/table>\n\n<hr>\n\n<h2>3. Windows \u306e\u6a5f\u80fd\uff08\u6709\u52b9\u5316\u3059\u308b\u3082\u306e\uff09<\/h2>\n<p>WSL2 \u3092\u4f7f\u3046\u306a\u3089\u3001\u6b21\u306e 2 \u3064\u306b\u30c1\u30a7\u30c3\u30af \u2192 \u518d\u8d77\u52d5\u3002<\/p>\n<ul>\n  <li class=\"ok\">Linux \u7528 Windows \u30b5\u30d6\u30b7\u30b9\u30c6\u30e0<\/li>\n  <li class=\"ok\">Virtual Machine Platform\uff08\u4eee\u60f3\u30de\u30b7\u30f3\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\uff09<\/li>\n<\/ul>\n<p>Docker \u3084\u4e00\u90e8\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u3092\u4f7f\u3046\u5834\u5408\u306e\u307f <em>Windows \u30cf\u30a4\u30d1\u30fc\u30d0\u30a4\u30b6\u30fc \u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0<\/em> \u3092 ON\u3002\u305d\u306e\u4ed6\uff08IIS\u3001SMB1.0\u3001Telnet\u3001<span class=\"bad\">Windows PowerShell 2.0<\/span> \u306a\u3069\uff09\u306f\u4e0d\u8981\u30fbOFF \u3067\u554f\u984c\u306a\u3057\u3002<\/p>\n\n<hr>\n\n<h2>4. WSL2 \u306e\u5c0e\u5165\u3068\u78ba\u8a8d\uff08PowerShell\uff09<\/h2>\n<p>\u7ba1\u7406\u8005 PowerShell \u3067\u5b9f\u884c\u3002\u3059\u3067\u306b\u5b8c\u4e86\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u5fa9\u7fd2\u3068\u3057\u3066\u63b2\u8f09\u3002<\/p>\n<pre><code># \u6a5f\u80fd\u306e\u6709\u52b9\u5316\uff08\u672a\u6709\u52b9\u306a\u3089\uff09\ndism.exe \/online \/enable-feature \/featurename:Microsoft-Windows-Subsystem-Linux \/all \/norestart\ndism.exe \/online \/enable-feature \/featurename:VirtualMachinePlatform \/all \/norestart\n\n# \u518d\u8d77\u52d5\u5f8c\u306b\u5c0e\u5165\nwsl --install -d Ubuntu\nwsl --set-default-version 2\n\n# \u72b6\u614b\u78ba\u8a8d\nwsl --status\nwsl --list --verbose\n<\/code><\/pre>\n<p>\u60f3\u5b9a\u51fa\u529b\uff1a<\/p>\n<pre><code>\u65e2\u5b9a\u306e\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3: Ubuntu\n\u65e2\u5b9a\u306e\u30d0\u30fc\u30b8\u30e7\u30f3: 2\n\nNAME     STATE    VERSION\n* Ubuntu Running  2\n<\/code><\/pre>\n<p class=\"small\">\u6ce8\uff1a\u300c<code>wsl: command not found<\/code>\u300d\u306f <em>wsl:<\/em> \u3068\u3044\u3046\u6587\u5b57\u5217\u3092\u6253\u3063\u305f\u5165\u529b\u30df\u30b9\u306e\u5178\u578b\u3002\u6b63\u3057\u304f\u306f <code>wsl<\/code>\uff08\u30b3\u30ed\u30f3\u7121\u3057\uff09\u3002<\/p>\n\n<hr>\n\n<h2>5. Ubuntu\uff08WSL2 \u5185\uff09\u3067 Node LTS + pnpm<\/h2>\n<p>WSL2 \u306e Ubuntu \u30bf\u30fc\u30df\u30ca\u30eb\u3067\u5b9f\u884c\u3002\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f <strong>Linux \u5074\u306e\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\uff08\u4f8b\uff1a<code>~\/src<\/code>\uff09<\/strong> \u306b\u7f6e\u304f\u3068\u9ad8\u901f\u3067\u3059\uff08<code>\/mnt\/c<\/code> \u306f\u9045\u3044\uff09\u3002<\/p>\n<pre><code>sudo apt-get update\ncurl -fsSL https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.39.7\/install.sh | bash\nsource ~\/.nvm\/nvm.sh\nnvm install --lts\ncorepack enable\ncorepack prepare pnpm@9 --activate\nnode -v &amp;&amp; pnpm -v\n<\/code><\/pre>\n\n<hr>\n\n<h2>6. Vite + React\/TypeScript \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<\/h2>\n<pre><code>mkdir -p ~\/src &amp;&amp; cd ~\/src\nnpm create vite@latest pwa-app -- --template react-ts\ncd pwa-app\npnpm i\npnpm add -D vite-plugin-pwa workbox-window\n<\/code><\/pre>\n\n<h3>6.1 <code>vite.config.ts<\/code>\uff08PWA \u3068 API \u30d7\u30ed\u30ad\u30b7\uff09<\/h3>\n<p>\u958b\u767a\u4e2d\u306b Service Worker \u3092\u6709\u52b9\u5316\u3057\u3001<code>\/api<\/code> \u3092 Laravel \u306b\u30d7\u30ed\u30ad\u30b7\u3057\u307e\u3059\u3002<\/p>\n<pre><code>import { defineConfig } from 'vite'\nimport react from '@vitejs\/plugin-react'\nimport { VitePWA } from 'vite-plugin-pwa'\n\nexport default defineConfig({\n  plugins: [\n    react(),\n    VitePWA({\n      registerType: 'autoUpdate',\n      manifest: {\n        name: 'GPX\/Video Uploader',\n        short_name: 'Uploader',\n        start_url: '\/?source=pwa',\n        display: 'standalone',\n        background_color: '#ffffff',\n        theme_color: '#0ea5e9',\n        icons: [\n          { src: 'icons\/icon-192.png', sizes: '192x192', type: 'image\/png' },\n          { src: 'icons\/icon-512.png', sizes: '512x512', type: 'image\/png' }\n        ]\n      },\n      workbox: {\n        navigateFallback: '\/index.html',\n        runtimeCaching: [{ urlPattern: \/^\\\/api\\\/\/, handler: 'NetworkFirst' }]\n      },\n      devOptions: { enabled: true }\n    })\n  ],\n  server: {\n    host: true,\n    proxy: { '\/api': { target: 'http:\/\/localhost:8000', changeOrigin: true } }\n  }\n})\n<\/code><\/pre>\n\n<h3>6.2 PWA \u30a2\u30a4\u30b3\u30f3\u306e\u914d\u7f6e<\/h3>\n<p>\u6700\u521d\u306f\u30a2\u30a4\u30b3\u30f3\u304c\u7121\u304f\u3066 OK \u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<strong>\u81ea\u5206\u3067\u4f5c\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<\/strong>\u3002\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u300c\u30b3\u30de\u30f3\u30c9\u306e\u3088\u3046\u306b\u300d\u53e9\u304f\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u3067\u6ce8\u610f\u3002<\/p>\n<pre><code>mkdir -p public\/icons\n# \u4f8b\uff1a\u7c21\u6613\u30a2\u30a4\u30b3\u30f3\u3092 ImageMagick \u3067\u751f\u6210\nsudo apt-get install -y imagemagick\nconvert -size 192x192 xc:\"#0ea5e9\" public\/icons\/icon-192.png\nconvert -size 512x512 xc:\"#0ea5e9\" public\/icons\/icon-512.png\n\n# \u307e\u305f\u306f Python\/Pillow\npython3 - &lt;&lt;'PY'\nfrom PIL import Image, ImageDraw\nfor s in (192,512):\n    im=Image.new('RGBA',(s,s),'#0ea5e9')\n    d=ImageDraw.Draw(im); d.ellipse((s*0.2,s*0.2,s*0.8,s*0.8), fill='white')\n    im.save(f'public\/icons\/icon-{s}.png')\nPY\n<\/code><\/pre>\n\n<h3>6.3 \u8d77\u52d5<\/h3>\n<pre><code>pnpm dev\n# \u30d6\u30e9\u30a6\u30b6\u3067 http:\/\/localhost:5173\n# DevTools \u2192 Application \u2192 Service Workers \u3067\u767b\u9332\u78ba\u8a8d\n<\/code><\/pre>\n<p class=\"small\">\u88dc\u8db3\uff1a<strong>localhost \u306f\u5b89\u5168\u6271\u3044<\/strong>\u306e\u305f\u3081\u3001\u958b\u767a\u6642\u306f HTTPS \u3067\u306a\u304f\u3066\u3082 SW \u304c\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/p>\n\n<hr>\n\n<h2>7. Laravel API \u5074\uff08\u7c21\u5358\u306a\u9023\u643a\uff09<\/h2>\n<p>\u958b\u767a\u4e2d\u306f Laravel \u3092\u30ed\u30fc\u30ab\u30eb\u3067\u8d77\u52d5\u3057\u3001\u30d5\u30ed\u30f3\u30c8\u304b\u3089\u306f <code>\/api<\/code> \u30d7\u30ed\u30ad\u30b7\u3067\u53e9\u304d\u307e\u3059\u3002<\/p>\n<pre><code># Laravel \u5074\uff08WSL \u3067\u3082 Windows \u5074\u3067\u3082\u53ef\uff09\nphp artisan serve --host=0.0.0.0 --port=8000\n<\/code><\/pre>\n<ul>\n  <li>CORS \u306f <code>http:\/\/localhost:5173<\/code> \u3092\u8a31\u53ef\uff08Sanctum SPA \u30e2\u30fc\u30c9 or PAT\uff09\u3002<\/li>\n  <li>PWA \u5074\u304b\u3089 <code>fetch('\/api\/...')<\/code> \u3067\u547c\u3079\u3070\u3001Vite \u306e\u30d7\u30ed\u30ad\u30b7\u304c <code>http:\/\/localhost:8000<\/code> \u306b\u4e2d\u7d99\u3002<\/li>\n<\/ul>\n\n<hr>\n\n<h2>8. Android \u5b9f\u6a5f\u30c6\u30b9\u30c8\uff08\u30ed\u30fc\u30ab\u30eb\u63a5\u7d9a\uff09<\/h2>\n<p>Android \u306e\u958b\u767a\u8005\u30e2\u30fc\u30c9\u3092\u6709\u52b9\u5316\u3057\u3001<code>adb<\/code> \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u7aef\u672b\u3068 PC \u3092 USB \u63a5\u7d9a\u3002<\/p>\n<pre><code>adb devices\nadb reverse tcp:5173 tcp:5173\nadb reverse tcp:8000 tcp:8000\n# \u7aef\u672b\u306e Chrome \u3067 http:\/\/localhost:5173 \u2192 \u300c\u30db\u30fc\u30e0\u753b\u9762\u306b\u8ffd\u52a0\u300d\u3067 PWA \u8d77\u52d5\n<\/code><\/pre>\n<p class=\"small\">HTTPS \u3092\u4f7f\u3063\u305f\u5916\u90e8\u7aef\u672b\u691c\u8a3c\u304c\u5fc5\u8981\u306a\u5834\u5408\u306e\u307f\u3001<strong>mkcert<\/strong> \u7b49\u3067\u30ed\u30fc\u30ab\u30eb\u8a3c\u660e\u66f8\u3092\u767a\u884c\u3057\u3001Vite \u306e <code>server.https<\/code> \u306b\u8a2d\u5b9a\u3002\u305f\u3060\u3057\u65e5\u5e38\u306e\u958b\u767a\u3067\u306f\u4e0d\u8981\u3067\u3059\u3002<\/p>\n\n<hr>\n\n<h2>9. \u3088\u304f\u3042\u308b\u30cf\u30de\u308a\u3069\u3053\u308d\u3068\u5bfe\u51e6<\/h2>\n<ul>\n  <li><strong><code>wsl: command not found<\/code><\/strong>\uff1aPowerShell \u3067\u306f\u306a\u304f\u5225\u30b7\u30a7\u30eb\uff08Git Bash \u7b49\uff09\u3067\u5b9f\u884c\u3057\u3066\u3044\u308b\u3001\u307e\u305f\u306f\u5358\u306b <em>wsl:<\/em> \u3068\u6253\u3063\u3066\u3044\u308b\u3002<code>wsl<\/code> \u3092 <strong>PowerShell\/CMD<\/strong> \u3067\u3002<\/li>\n  <li><strong>Vite \u306e URL \u304c\u7aef\u672b\u304b\u3089\u898b\u3048\u306a\u3044<\/strong>\uff1a<code>adb reverse<\/code> \u3092\u5b9f\u884c\u3001\u307e\u305f\u306f\u540c\u4e00 Wi-Fi \u3067 PC \u306e IP \u3092\u4f7f\u3046\u3002<\/li>\n  <li><strong>\u30a2\u30a4\u30b3\u30f3\u304c\u7121\u3044<\/strong>\uff1a<code>public\/icons<\/code> \u3092\u4f5c\u3063\u3066 <code>icon-192.png<\/code>, <code>icon-512.png<\/code> \u3092\u914d\u7f6e\u3002\u30d1\u30b9\u3092\u300c\u5b9f\u884c\u300d\u3057\u306a\u3044\u3053\u3068\u3002<\/li>\n  <li><strong>WSL \u306e\u6027\u80fd\u304c\u9045\u3044<\/strong>\uff1a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f <code>~\/src<\/code>\uff08Linux \u5074\uff09\u306b\u7f6e\u304f\u3002<code>\/mnt\/c<\/code> \u306f\u907f\u3051\u308b\u3002<\/li>\n  <li><strong>Service Worker \u304c\u66f4\u65b0\u3055\u308c\u306a\u3044<\/strong>\uff1avite-plugin-pwa \u306e <code>registerType:'autoUpdate'<\/code> \u3067\u81ea\u52d5\u66f4\u65b0\u3002\u624b\u52d5\u306a\u3089 DevTools \u306e\u300cUnregister\u300d\u2192 \u30ea\u30ed\u30fc\u30c9\u3002<\/li>\n<\/ul>\n\n<hr>\n\n<h2>10. \u4efb\u610f\uff1a\u30ed\u30fc\u30ab\u30eb HTTPS\uff08mkcert\uff09<\/h2>\n<p>\u5916\u90e8\u7aef\u672b\u304b\u3089 <code>https:\/\/&lt;PC-IP&gt;:5173<\/code> \u3067\u691c\u8a3c\u3057\u305f\u3044\u5834\u5408\u306e\u307f\u3002Windows \u5074\u3067\u4e00\u5ea6\u3060\u3051\u7ba1\u7406\u8005\u6a29\u9650\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<pre><code># PowerShell\uff08\u7ba1\u7406\u8005\uff09\u3067 mkcert \u3092\u5c0e\u5165\uff08Chocolatey\u4f8b\uff09\nchoco install mkcert -y\nmkcert -install\n\n# \u8a3c\u660e\u66f8\u4f5c\u6210\uff08\u4efb\u610f\u306e\u30d5\u30a9\u30eb\u30c0\u3067\uff09\nmkdir cert &amp; cd cert\nmkcert localhost 127.0.0.1 ::1\n\n# Vite \u306e server.https \u306b\u8a2d\u5b9a\uff08vite.config.ts\uff09\nserver: {\n  https: {\n    key: fs.readFileSync('cert\/localhost-key.pem'),\n    cert: fs.readFileSync('cert\/localhost.pem')\n  },\n  host: true\n}\n<\/code><\/pre>\n<p class=\"small\">\u958b\u767a\u4e2d\u306f\u57fa\u672c\u7684\u306b <strong>HTTP \u306e localhost \u3067\u5341\u5206<\/strong>\u3067\u3059\uff08SW \u52d5\u4f5c\u53ef\uff09\u3002<\/p>\n\n<hr>\n\n<h2>11. \u4ed5\u4e0a\u3052\u30c1\u30a7\u30c3\u30af\uff08Lighthouse\uff09<\/h2>\n<ul>\n  <li>Chrome DevTools \u2192 Lighthouse \u2192 <strong>PWA<\/strong> \u30ab\u30c6\u30b4\u30ea\u3092\u5b9f\u884c<\/li>\n  <li>\u8981\u4ef6\uff1aManifest \/ Service Worker \/ \u30a2\u30a4\u30b3\u30f3 \/ \u30aa\u30d5\u30e9\u30a4\u30f3\u5bfe\u5fdc \/ HTTPS\uff08\u672c\u756a\uff09<\/li>\n<\/ul>\n\n<hr>\n\n<h2>12. \u6b21\u306e\u62e1\u5f35<\/h2>\n<ul>\n  <li>\u5927\u5bb9\u91cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\uff1a<strong>S3 Multipart \u76f4 PUT<\/strong> \u307e\u305f\u306f <strong>tus<\/strong> \u306b\u5bfe\u5fdc\u3057\u3001IndexedDB \u3067\u30ec\u30b8\u30e5\u30fc\u30e0<\/li>\n  <li>GPX\/POI \u53ef\u8996\u5316\uff1aLeaflet\/MapLibre \u3092\u8ffd\u52a0\u3001\u9001\u4fe1\u524d\u78ba\u8a8d\u3092 UI \u5316<\/li>\n  <li>Sanctum \u8a8d\u8a3c\uff1a\u30c6\u30ca\u30f3\u30c8\u30b9\u30b3\u30fc\u30d7\uff08\u4f1a\u793e\/\u90e8\u7f72\/\u7aef\u672b\uff09\u3092\u30d5\u30ed\u30f3\u30c8\u8a2d\u5b9a\u306b\u4fdd\u5b58<\/li>\n  <li>\u7aef\u672b\u5185\u524d\u51e6\u7406\uff1a\u5fc5\u8981\u306b\u5fdc\u3058\u3066 tfjs \/ ORT Web \u3092\u5c0e\u5165\uff08\u30e2\u30c7\u30eb\u306f IndexedDB \u30ad\u30e3\u30c3\u30b7\u30e5\uff09<\/li>\n<\/ul>\n\n<hr>\n\n<h2>\u4ed8\u9332\uff1a\u5b9f\u65bd\u30b3\u30de\u30f3\u30c9\u307e\u3068\u3081<\/h2>\n<pre><code># PowerShell\uff08\u7ba1\u7406\u8005\uff09\ndism \/online \/enable-feature \/featurename:Microsoft-Windows-Subsystem-Linux \/all \/norestart\ndism \/online \/enable-feature \/featurename:VirtualMachinePlatform \/all \/norestart\nwsl --install -d Ubuntu\nwsl --set-default-version 2\nwsl --list --verbose --status\n\n# Ubuntu\uff08WSL2\uff09\ncurl -fsSL https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.39.7\/install.sh | bash\nsource ~\/.nvm\/nvm.sh\nnvm install --lts\ncorepack enable &amp;&amp; corepack prepare pnpm@9 --activate\nnpm create vite@latest pwa-app -- --template react-ts\ncd pwa-app &amp;&amp; pnpm i &amp;&amp; pnpm add -D vite-plugin-pwa workbox-window\nmkdir -p public\/icons\nconvert -size 192x192 xc:\"#0ea5e9\" public\/icons\/icon-192.png\nconvert -size 512x512 xc:\"#0ea5e9\" public\/icons\/icon-512.png\npnpm dev\n\n# Android \u5b9f\u6a5f\nadb reverse tcp:5173 tcp:5173\nadb reverse tcp:8000 tcp:8000\n<\/code><\/pre>\n\n<p class=\"small\">\u3053\u308c\u3067\u3001Windows \u4e0a\u306e WSL2 \u3092\u8ef8\u306b PWA \u306e\u30d3\u30eb\u30c9\/\u5b9f\u6a5f\u691c\u8a3c\/\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u9023\u643a\u307e\u3067\u4e00\u901a\u308a\u56de\u305b\u307e\u3059\u3002\u8ffd\u52a0\u3067 S3 \u76f4 PUT\u30fbtus \u3092\u7d44\u307f\u8fbc\u307f\u305f\u3044\u5834\u5408\u306f\u3001\u305d\u306e\u307e\u307e\u96db\u5f62\u3092\u62e1\u5f35\u3067\u304d\u307e\u3059\u3002\u00a9\u682a\u5f0f\u4f1a\u793e\u30d3\u30fc\u30fb\u30ca\u30ec\u30c3\u30b8\u30fb\u30c7\u30b6\u30a4\u30f3<\/p>\n\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Windows \u3067\u306e PWA \u958b\u767a\u74b0\u5883\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\uff08WSL2 + Node + pnpm + Vite + Laravel \u9023\u643a\uff09 \u3053\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u3001\u3053\u308c\u307e\u3067\u5b9f\u65bd\u3057\u305f Windows \u5074\u306e\u74b0\u5883\u8a2d\u5b9a\u3092 \u518d\u73fe\u6027\u306e\u3042\u308b\u624b\u9806\u3068 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"vkexunit_cta_each_option":"","footnotes":""},"categories":[6,54],"tags":[51,75,74],"class_list":["post-1591","post","type-post","status-publish","format-standard","hentry","category-programing","category-54","tag-51","tag-75","tag-74"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/1591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1591"}],"version-history":[{"count":2,"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/1591\/revisions"}],"predecessor-version":[{"id":1593,"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/1591\/revisions\/1593"}],"wp:attachment":[{"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/beeknowledge.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}