{"id":10747,"date":"2022-07-04T07:00:18","date_gmt":"2022-07-03T22:00:18","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=10747"},"modified":"2022-09-07T14:35:34","modified_gmt":"2022-09-07T05:35:34","slug":"laravel-%e3%81%ae%e5%85%ac%e5%bc%8f-vite-%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%a7-vue-3-%e3%81%8c%e4%bd%bf%e3%81%88%e3%82%8b%e3%82%88%e3%81%86%e3%81%ab%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=10747","title":{"rendered":"Laravel \u306e\u516c\u5f0f Vite \u30d7\u30e9\u30b0\u30a4\u30f3\u3067 Vue 3 \u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u306e\u9593 <a href=\"https:\/\/twitter.com\/circleback\/status\/1539880226238640128\" target=\"_blank\" rel=\"noopener\">circleback \u3055\u3093\u306e\u30c4\u30a4\u30fc\u30c8<\/a>\u3092\u898b\u3066\u300c\u304a\u304a\u3063\u2757\u300d\u3068\u601d\u3063\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">Vite \u304c\u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u306a\u308b<\/strong><\/p>\n<p>\u3068\u3044\u3046\u3082\u306e\u3067\u3057\u305f\u3002<\/p>\n<p><code>Vite<\/code>\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u5b9f\u306f\u3053\u308c\u306f\u516c\u5f0f\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u306f\u306a\u304b\u3063\u305f\u3093\u3067\u3059\u306d\u3002<\/p>\n<p><strong>\ud83d\udcdd\u53c2\u8003URL\uff1a<\/strong>\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=10168\" target=\"_blank\" rel=\"noopener\">Laravel 9.x \u3067\u9ad8\u901f\u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u300cVite\u300d\u3092\u4f7f\u3063\u3066\u307f\u308b<\/a><\/p>\n<p>\u3057\u304b\u3057\u3001\u4eca\u56de\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3067<code>Vite<\/code>\u304c\u521d\u671f\u72b6\u614b\u3067\u516c\u5f0f\u3068\u3057\u3066\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093<code>Laravel Mix<\/code>\uff08<code>webpack<\/code>\uff09\u3082\u3044\u3044\u3093\u3067\u3059\u304c\u3001\u500b\u4eba\u7684\u306b\u306f\u30d3\u30eb\u30c9\u6642\u9593\u304c\u9577\u3059\u304e\u3066\u958b\u767a\u52b9\u7387\u304c\u60aa\u304f\u306a\u308b\u305f\u3081\u3001\u307b\u3068\u3093\u3069\u4f7f\u3063\u3066\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u3067\u3082\u3001<code>Vite<\/code>\u306e\u30c6\u30fc\u30de\u306f\u300c<strong>\u8d85\u9ad8\u901f<\/strong>\u300d\u3067\u3059\u306e\u3067\u3001\u3053\u306e\u30c7\u30e1\u30ea\u30c3\u30c8\u306f\u89e3\u6d88\u3055\u308c\u305f\u3068\u8a00\u3063\u3066\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u3001<code>Laravel<\/code>\u516c\u5f0f\u306e<code>Vite<\/code>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066<code>Vue 3<\/code>\u3092\u52d5\u304b\u3059\u3068\u3053\u308d\u307e\u3067\u3092\u5b9f\u88c5\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\ud83d\ude04\u2728<\/p>\n<p><strong>\u3010\u8ffd\u8a18\uff1a 2022.9.7\u3011<br \/>\n<\/strong>\u73fe\u5728<code>Laravel<\/code>\u306b\u306f<code>Vite<\/code>\u304c\u6a19\u6e96\u642d\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8a73\u3057\u304f\u306f\u3001<a href=\"https:\/\/blog.capilano-fw.com\/?p=10845\" target=\"_blank\" rel=\"noopener\">\u3010Laravel\u3011Vite + Inertia + React \u3067\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/a>\u00a0\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u68ee\u5ca1\u6bc5\u3055\u3093\u306e\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0<br \/>\n\u3092\u52c9\u5f37\u4e2d\u2757\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 9.20\u3001PHP 8.0<\/p>\n<h1>Laravel \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p><code>Laravel<\/code>\u306f\u3053\u308c\u307e\u3067\u3001<code>JavaScript<\/code>\u3084<code>CSS<\/code>\u306e\u30d3\u30eb\u30c9\u306b<code>Laravel Mix<\/code>\uff08<code>webpack<\/code>\uff09\u3092\u4f7f\u3063\u3066\u304d\u307e\u3057\u305f\u306e\u3067\u3001\u3082\u3057\u305d\u306e\u72b6\u614b\u3092<code>Vite<\/code>\u306b\u79fb\u884c\u3059\u308b\u306b\u306f\u3044\u308d\u3044\u308d\u3068\u4f5c\u696d\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u203b \u3082\u3057\u305d\u306e\u5834\u5408\u306f\u4ee5\u4e0b\u3092\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003URL\uff1a<\/strong>\u00a0<a href=\"https:\/\/github.com\/laravel\/vite-plugin\/blob\/main\/UPGRADE.md#migrating-from-laravel-mix-to-vite\" target=\"_blank\" rel=\"noopener\">Migrating from Laravel Mix to Vite<\/a>\uff08\u82f1\u8a9e\uff09<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u4eca\u56de\u306f<code>Laravel<\/code>\u3092\u65b0\u898f\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u9032\u3081\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>composer create-project laravel\/laravel vite-plugin<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>Laravel 9.2.0<\/code>\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\uff082022.6.29 \u73fe\u5728\uff09<\/p>\n<p>\u203b \u306a\u304a\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f<code>Laravel<\/code>\u306f<code>vite-plugin.test<\/code>\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u524d\u63d0\u3067\u9032\u3081\u3066\u3044\u304d\u307e\u3059\ud83d\udc4d<\/p>\n<h1>Vite \u304c\u4f7f\u3048\u308b\u74b0\u5883\u3092\u6574\u3048\u308b<\/h1>\n<p>\u307e\u305a\u3001<code>Vite<\/code>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u3067\u3059\u304c\u3001<code>Laravel<\/code>\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u521d\u671f\u72b6\u614b\u3067\u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u3068\u3057\u3066\u4f7f\u308f\u308c\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>package.json<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10749\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_1.png\" alt=\"\" width=\"462\" height=\"403\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_1.png 462w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_1-300x262.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067<code>Vite<\/code>\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u5b8c\u4e86\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>npm install<\/strong><\/pre>\n<p>\u306a\u304a\u3001\u79c1\u306f\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u306b\u300c<code>vite-plugin.test<\/code>\u300d\u3068\u3044\u3046\u3088\u3046\u306a\u958b\u767a\u7528\u30c9\u30e1\u30a4\u30f3\u3092\u3064\u304f\u308a\u3001<code>nginx<\/code>\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3084\u3089\u3053\u306e\u5f62\u3060\u3068<code>localhost:3000<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3059\u3079\u304d\u3082\u306e\u304c<code>vite-plugin.test<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3055\u308c\u3066\u3057\u307e\u3044\u3001\u7d50\u679c\u81ea\u52d5\u30ea\u30ed\u30fc\u30c9\u304c\u52b9\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u3046\u3044\u3063\u305f\u5834\u5408\u306f<code>vite.config.js<\/code>\u306b\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\nexport default defineConfig({\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n<strong>    server: {<\/strong>\r\n<strong>        host: true<\/strong>\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<h1>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u306f<code>vue<\/code>\u3092\u4f7f\u3044\u307e\u3059\u306e\u3067\u3001<code>vite<\/code>\u306b\u5bfe\u5fdc\u3059\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>npm i @vitejs\/plugin-vue --save-dev<\/strong><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3060\u3051\u3067\u306f\u3053\u306e<code>vue<\/code>\u7528\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u6709\u52b9\u306b\u306a\u308a\u307e\u305b\u3093\u306e\u3067\u3001<code>vite<\/code>\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<code>vite.config.js<\/code>\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>vite.config.js<\/strong><\/p>\n<pre>import { defineConfig } from 'vite';\r\nimport laravel from 'laravel-vite-plugin';\r\n<strong>import vue from '@vitejs\/plugin-vue'<\/strong>\r\n\r\nexport default defineConfig({\r\n    plugins: [\r\n        laravel([\r\n            'resources\/css\/app.css',\r\n            'resources\/js\/app.js',\r\n        ]),\r\n        <strong>vue(),<\/strong>\r\n    ],\r\n});<\/pre>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001<code>vite<\/code>\u306b\u5bfe\u5fdc\u3059\u308b\u30d3\u30e5\u30fc\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u3067\u3059\u306e\u3067\u3001\u521d\u671f\u72b6\u614b\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308b<code>welcome.blade.php<\/code>\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>resources\/views\/welcome.blade.php<\/strong><\/p>\n<pre>&lt;!doctype html&gt;\r\n&lt;html lang=\"{{ str_replace('_', '-', app()-&gt;getLocale()) }}\"&gt;\r\n    &lt;head&gt;\r\n        <strong>@vite(['resources\/css\/app.css', 'resources\/js\/app.js'])<\/strong>\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        <strong>&lt;h1&gt;<\/strong>\r\n<strong>            Vite \u306e\u30c6\u30b9\u30c8\u3067\u3059<\/strong>\r\n<strong>        &lt;\/h1&gt;<\/strong>\r\n<strong>        &lt;div id=\"app\"&gt;<\/strong>\r\n<strong>            &lt;span v-text=\"greeting\"&gt;&lt;\/span&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u306a\u304a\u3001<code>@vite<\/code>\u5185\u306b\u5165\u3063\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u66f4\u304c\u3042\u308b\u3068<code>vite<\/code>\u304c\u81ea\u52d5\u3067\u3044\u308d\u3044\u308d\u3068\u3084\u3063\u3066\u304f\u308c\u308b\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n<h1>JavaScript \u3068 CSS \u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001\u5148\u307b\u3069\u306e\u30d3\u30e5\u30fc\u3067\u8a2d\u5b9a\u3057\u305f<code>JavaScript<\/code>\u3068<code>CSS<\/code>\u90e8\u5206\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002\u307e\u305a\u306f<code>JavaScript<\/code>\u3067\u3059\u3002<\/p>\n<p><strong>resources\/js\/app.js<\/strong><\/p>\n<pre>import '.\/bootstrap';\r\n\r\n<strong>import { createApp, ref } from 'vue\/dist\/vue.esm-bundler';<\/strong>\r\n\r\n<strong>createApp({<\/strong>\r\n<strong>    setup() {<\/strong>\r\n\r\n<strong>        const greeting = ref('\u304a\u306f\u3088\uff01');<\/strong>\r\n\r\n<strong>        return {<\/strong>\r\n<strong>            greeting,<\/strong>\r\n<strong>        }<\/strong>\r\n\r\n<strong>    },<\/strong>\r\n<strong>}).mount('#app');<\/strong><\/pre>\n<p>\u203b \u3061\u306a\u307f\u306b\u3053\u306e\u5834\u5408\u3001<code>... from 'vue'<\/code> \u304c\u4f7f\u3048\u306a\u3044\u7406\u7531\u306f <strong><a href=\"#esm-bundler\">vue\/dist\/vue.esm-bundler \u304c\u5fc5\u8981\u306a\u7406\u7531<\/a><\/strong> \u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>CSS<\/code>\u3067\u3059\u3002<\/p>\n<p><strong>resources\/css\/app.css<\/strong><\/p>\n<pre><strong>h1 {<\/strong>\r\n<strong>    color: #ff0000;<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u30bb\u30c3\u30c8\u306f\u5168\u3066\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h1 id=\"esm-bundler\">\u3061\u306a\u307f\u306b: vue\/dist\/vue.esm-bundler \u304c\u5fc5\u8981\u306a\u7406\u7531<\/h1>\n<p>\u5076\u7136\u306b\u3082 <a href=\"https:\/\/twitter.com\/circleback\" target=\"_blank\" rel=\"noopener\">circleback \u3055\u3093<\/a> \u304b\u3089\u8a18\u4e8b\u516c\u958b\u524d\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u3044\u305f\u3060\u304d\u3001\u4ee5\u4e0b\uff12\u3064\u306e\u9055\u3044\u306b\u3064\u3044\u3066\u8cea\u554f\u3055\u308c\u305f\u306e\u3067\u3001\u8abf\u67fb\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<pre><strong>import { createApp } from 'vue\/dist\/vue.esm-bundler';<\/strong><\/pre>\n<pre><strong>import { createApp } from 'vue';<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u30d6\u30ed\u30b0\u304c\u3068\u3066\u3082\u5206\u304b\u308a\u3084\u3059\u304f\u7d39\u4ecb\u3057\u3066\u304f\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003URL:\u00a0<\/strong> <a href=\"https:\/\/qiita.com\/sansaisoba\/items\/58f8176f6e462fe4d591\" target=\"_blank\" rel=\"noopener\">Vue.js\u306e\u5b8c\u5168\u30d3\u30eb\u30c9\u3068\u30e9\u30f3\u30bf\u30a4\u30e0\u30d3\u30eb\u30c9\u306e\u9055\u3044<\/a><\/p>\n<p>\u3064\u307e\u308a\u3001\u4eca\u56de\u306e\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u300c<strong>\u52d5\u304d\u304c\u3042\u308b\u90e8\u5206<\/strong>\u300d\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u305f\u3081\u3001<code>Vue<\/code>\u306f\u3053\u306e\u90e8\u5206\u306e\u89e3\u6790\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u3053\u306e\u5f71\u97ff\u3067\u5b8c\u5168\u30d3\u30eb\u30c9\uff08<code>vue\/dist\/vue.esm-bundler<\/code>\uff09\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308b\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n<pre>&lt;div id=\"app\"&gt;\r\n    <strong>&lt;span v-text=\"greeting\"&gt;&lt;\/span&gt; &lt;!-- \ud83d\udc48 \u3053\u3061\u3089 --&gt;<\/strong>\r\n&lt;\/div&gt;<\/pre>\n<p>\u203b \u306a\u304a\u3001\u300c\u30e9\u30f3\u30bf\u30a4\u30e0\u30d3\u30eb\u30c9\u300d\u306f\u3053\u306e\u89e3\u6790\u304c\u4e0d\u8981\u306a\u5206\u3001<code>30%<\/code>\u9ad8\u901f\u306b\u52d5\u304f\u3089\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>\u52c9\u5f37\u306b\u306a\u308a\u307e\u3057\u305f\u2757<br \/>\n\u304a\u4e8c\u65b9\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f m(_ _)m<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b<code>vite<\/code>\u3092\u8d77\u52d5\u3057\u3066\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>npm run dev<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u8868\u793a\u304c\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10750\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_2.png\" alt=\"\" width=\"384\" height=\"325\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_2.png 384w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_2-300x254.png 300w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/p>\n<p>\u3061\u306a\u307f\u306b\u3001<code>APP_URL<\/code>\u304c<code>https:\/\/vite-plugin.test<\/code>\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u306f\u3001<code>.env<\/code>\u306e<code>APP_URL<\/code>\u3092\u5909\u66f4\u3057\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067<code>https:\/\/vite-plugin.test<\/code>\u3078\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3069\u3046\u306a\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10751\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_3.png\" alt=\"\" width=\"293\" height=\"120\" \/><\/p>\n<p>\u306f\u3044\u2757<code>JavaScript<\/code>\u3068<code>CSS<\/code>\u304c\u3046\u307e\u304f\u52d5\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u307e\u307e\u306e\u72b6\u614b\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u63db\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u307e\u305a\u306f<code>Vue<\/code>\u5074\u306e\u300c\u3042\u3044\u3055\u3064\u300d\u3092\u5909\u66f4\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><strong>resources\/js\/app.js<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\ncreateApp({\r\n    setup() {\r\n\r\n        <strong>const greeting = ref('\u3053\u3093\u306b\u3061\u306f\uff01');<\/strong> \/\/ \ud83d\udc48 \u3053\u3053\u3092\u5909\u66f4\u3057\u307e\u3057\u305f\r\n\r\n        return {\r\n            greeting,\r\n        }\r\n\r\n    },\r\n}).mount('#app');<\/pre>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10752\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_4.png\" alt=\"\" width=\"300\" height=\"118\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u30ea\u30ed\u30fc\u30c9\u64cd\u4f5c\u306f\u5168\u304f\u3057\u3066\u3044\u306a\u3044\u306e\u306b\u30c6\u30ad\u30b9\u30c8\u304c\u5909\u66f4\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3082\u3001\u3053\u308c<strong style=\"font-size: 25px;\">\u300c\u8d85\u30a6\u30eb\u30c8\u30e9\u9ad8\u901f\u30de\u30c3\u30cf\u306a\u30b9\u30d4\u30fc\u30c9\u300d<\/strong>\u3067\u5b8c\u4e86\u3057\u307e\u3059\ud83d\udc4d<\/p>\n<p>\u3067\u306f\u3001<code>CSS<\/code>\u306e\u65b9\u3082\u901f\u3044\u304b\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>resources\/css\/app.css<\/strong><\/p>\n<pre>h1 {\r\n    color: #ff0000;\r\n    <strong>text-decoration: underline;<\/strong> \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\r\n}<\/pre>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10753\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_5.png\" alt=\"\" width=\"287\" height=\"123\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\nCSS\u3082\u8d85\u9ad8\u901f\u3067\u30ea\u30ed\u30fc\u30c9\u3055\u308c\u3001<code>h1<\/code>\u30bf\u30b0\u306b\u4e0b\u7dda\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude04\u2728<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u691c\u8a3c\u30c4\u30fc\u30eb\u3067\u3069\u3093\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u304b\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10756\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_8.png\" alt=\"\" width=\"286\" height=\"289\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_8.png 286w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_8-100x100.png 100w\" sizes=\"auto, (max-width: 286px) 100vw, 286px\" \/><\/p>\n<p>\u3044\u308d\u3044\u308d\u3068\u305f\u304f\u3055\u3093\u3042\u308a\u307e\u3059\u304c\u3001\u5909\u66f4\u3057\u305f\uff12\u30d5\u30a1\u30a4\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002\uff08\u3053\u3053\u304c<code>vite<\/code>\u304c\u304a\u4ed5\u4e8b\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u5834\u6240\u306e\u3088\u3046\u3067\u3059\u306d\uff09<\/p>\n<ul>\n<li><strong>http:\/\/[::]:3000\/resources\/js\/app.js<\/strong><\/li>\n<li><strong>http:\/\/[::]:3000\/resources\/css\/app.css<\/strong><\/li>\n<\/ul>\n<p>\u3067\u306f\u3001\u958b\u767a\u304c\u5b8c\u4e86\u3057\u3066\u672c\u756a\u306b\u30a2\u30c3\u30d7\u3059\u308b\u3068\u304d\u306e\u305f\u3081\u306b\u3042\u308b\u300c<strong>\u30d3\u30eb\u30c9<\/strong>\u300d\u3082\u4f7f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4e00\u65e6\u3001<code>Ctrl + C<\/code>\u3067<code>npm run dev<\/code>\u3092\u7d42\u4e86\u3057\u3001\u65b0\u305f\u306b\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>npm run build<\/strong><\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10755\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_6.png\" alt=\"\" width=\"294\" height=\"117\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n<code>vite<\/code>\u306f\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044\u3067\u3059\u304c\u3001\u5148\u307b\u3069\u3068\u540c\u3058\u304f\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u691c\u8a3c\u30c4\u30fc\u30eb\u3067\u306f\u3069\u3046\u306a\u3063\u3066\u3044\u308b\u304b\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10757\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_7.png\" alt=\"\" width=\"309\" height=\"115\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_7.png 309w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/laravel_vite_plugin_7-300x112.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><\/p>\n<p>\u5148\u307b\u3069\u3068\u306f\u9055\u3063\u3066\u30d5\u30a1\u30a4\u30eb\u304c\u5c11\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u306f\u5168\u3066<code>app.*****.css<\/code>\u3068<code>app.*****.js<\/code>\u306e\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u3072\u3068\u307e\u3068\u3081\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u3089\u306a\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u3059\u3079\u3066\u6210\u529f\u3067\u3059\ud83d\ude04\ud83d\udc4d\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u3053\u308c\u307e\u3067<code>webpack<\/code>\u3092\u5229\u7528\u3057\u305f\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u958b\u767a\u306f\u3001\u300c<strong>\u6bce\u56de\u30d3\u30eb\u30c9\u306b\u6642\u9593\u304c\u304b\u304b\u308b<\/strong>\u300d\u3068\u3044\u3046\u6700\u5927\u306e\u30c7\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u30b3\u30fc\u30c9\u3092\u5909\u66f4\u3059\u308b\u305f\u3073\u306b\u30d3\u30eb\u30c9\u304c\u5fc5\u8981\u306a\u305f\u3081\u3001\u300c<strong>\u958b\u767a\u30c6\u30f3\u30dd<\/strong>\u300d\u304c\u5931\u308f\u308c\u3001\u982d\u306e\u4e2d\u3068\u4f5c\u696d\u304c\u30df\u30b9\u30de\u30c3\u30c1\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u3053\u3093\u306a\u72b6\u614b\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u30b9\u30d4\u30fc\u30c9\u3092\u4e0a\u3052\u308b\u306e\u306f\u96e3\u3057\u3044\u3068\u3044\u3063\u3066\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001<code>vite<\/code>\u306f\u3053\u306e\u6642\u9593\u3092\u5927\u5e45\u306b\u77ed\u7e2e\u3057\u3001\u30d3\u30eb\u30c9\u306a\u3057\u3068\u5909\u308f\u3089\u306a\u3044\u3050\u3089\u3044\u9ad8\u901f\u3067\u958b\u767a\u3092\u9032\u3081\u3089\u308c\u308b\u305f\u3081\u5927\u5e45\u306a\u751f\u7523\u6027\u306e\u5411\u4e0a\u304c\u898b\u8fbc\u3081\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u3082\u3057<code>vite<\/code>\u3092\u4f7f\u3063\u305f\u958b\u767a\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u3001\u305c\u3072\u304a\u554f\u3044\u5408\u308f\u305b\u3088\u308a\u3054\u9023\u7d61\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude04\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u516c\u5f0f\u306b<code>Laravel<\/code>\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u305f<code>Vite<\/code>\u3092\u4f7f\u3063\u3066<code>JavaScript<\/code>\uff08<code>Vue 3<\/code>\uff09\u3068<code>CSS<\/code>\u3092\u30bb\u30c3\u30c8\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u969b\u306e\u904b\u7528\u3067\u306f\u30eb\u30fc\u30c8\u306e\u8a2d\u5b9a\u3082\u5fc5\u8981\u306b\u306a\u3063\u3066\u304f\u308b\u306e\u3067\u3001\u4eca\u56de\u306e\u3088\u3046\u306b\u30b7\u30f3\u30d7\u30eb\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304c\u3001\u958b\u767a\u901f\u5ea6\u304c\u3042\u304c\u308b\u306e\u3067<code>Vite<\/code>\u3092\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u306f\u5927\u304d\u3044\u3093\u3058\u3083\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u307e\u305f\u3001\u30d3\u30eb\u30c9\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u30e9\u30f3\u30c0\u30e0\u306a\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u308b\uff08\uff1d\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u52b9\u304b\u306a\u304f\u306a\u308b\uff09\u3068\u3044\u3046\u306e\u3082\u7d50\u69cb\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u3067\u3059\u306d\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082<code>vite<\/code>\u306b\u30c1\u30a7\u30ec\u30f3\u30b8\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<br \/>\n\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10758 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/no_21.png\" alt=\"\" width=\"370\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/no_21.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/06\/no_21-300x259.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u6c17\u6e29\u304c30\u2103\u8fd1\u304f\u306a\u308b\u3068\u3001<br \/>\n\u98a8\u304c\u3042\u3063\u3066\u3082<br \/>\n\u30c9\u30e9\u30a4\u30e4\u30fc\u306b\u5f53\u305f\u3063\u3066\u308b\u6c17\u5206\u3067\u3059\ud83d\ude2b\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u306e\u9593 circleback \u3055\u3093\u306e\u30c4\u30a4\u30fc\u30c8\u3092\u898b\u3066\u300c\u304a\u304a\u3063\u2757\u300d\u3068\u601d\u3063\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb Vite \u304c\u30d3\u30eb\u30c9\u30c4\u30fc\u30eb\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u306a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=10747\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel \u306e\u516c\u5f0f Vite \u30d7\u30e9\u30b0\u30a4\u30f3\u3067 Vue 3 \u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":10761,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12],"tags":[245],"class_list":["post-10747","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-vue-js","tag-vite"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10747"}],"version-history":[{"count":11,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10747\/revisions"}],"predecessor-version":[{"id":10763,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10747\/revisions\/10763"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/10761"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}