Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Vue + Laravel integration


Hi,

I'm purchased Metronic 8 and I'm following the steps in https://preview.keenthemes.com/metronic8/vue/docs/#/vue-laravel-integration. But by following these steps I couldn't get it working. Can you check if it's up to date or make some video on this topic?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Hi,

Thank you for your feedback.

We checked our doc and some code previews are outdated. Follow the steps below to fix your integration.


  1. Use the actual tsconfig.json from vue demo root folder.

  2. Update your webpack.mix.js as shown below.

    const mix = require("laravel-mix");
    const path = require("path");

    mix.ts("resources/ts/app.ts", "public/js")
    .vue({version: 3,})
    .webpackConfig({
    module: {
    rules: [
    {
    test: /\.tsx?$/,
    loader: "ts-loader",
    exclude: /node_modules/,
    options: {
    appendTsSuffixTo: [/\.vue$/],
    // For production mode change it to false
    // It"s long but it checks types and generates definitions
    transpileOnly: true
    }
    },
    {
    test: /.mjs$/i,
    resolve: {
    byDependency: { esm: { fullySpecified: false } },
    },
    },
    ],
    },
    resolve: {
    alias: {
    "@": path.resolve(__dirname, "resources/ts/src/"),
    },
    },
    });




Also, you can check our vue 3 + laravel 9 (with Vite) integration post:
https://devs.keenthemes.com/question/laravel-9-with-vite-vue-3-integration

Regards,
Lauris Stepanovs,
Keenthemes Support Team

Hi,

Thanks for the quick reply. I'm using laravel 9 and vite. After searching further in the question I found the same post. I've followed it and it's working now, but I still have some questions:

1. When I run npm run dev and php artisan serve it's working, but I can't use this in production. So I have changed the vite.config.js to:

import path from "path"
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue"
import laravel from "laravel-vite-plugin";
export default defineConfig({
resolve: {
alias: [
{ find: "~bootstrap", replacement: path.resolve(__dirname,"node_modules/bootstrap")},
{ find: "@", replacement: path.resolve(__dirname,"resources/ts/src/") }
]
},
plugins: [
vue({
template: {
transformAssetUrls: {
base: "plugin/",
includeAbsolute: false,
},
},
}),
laravel({
input: [
"resources/css/app.css",
"resources/ts/app.ts"
],
refresh: true,
}),
],
});


Is this the correct way?

2. I have downloaded and integrated demo8, but where can I find the fonticon and splash-screen.css files, it's not in the downloaded zip? Now I'm getting console errors about those files.

3. How can I get the .env variables after running npm run build, because import.meta.env.VITE_APP_NAME is not working?



Hi,


  1. Your configuration looks fine. Did you have any errors in production?

  2. You can find fonticon folder and splash-screen.css in public/ folder.

  3. import.meta.env.VITE_APP_NAME should work fine. Please make sure that you have included VITE_APP_NAME variable in your .env file.



Regards,
Lauris Stepanovs,
Keenthemes Support Team

Thanks, everything works fine, but it isn't there. There is only media folder, favicon.ico and index.html

Btw don't you have any laravel+vue starter template where it's already integrated including the migration files and auths etc.?



i've downloaded demo8 vue again, and there is no splash-screen.css and fonticon.css


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(