Open Felipe-DevT00ls opened 2 months ago
To solve this problem by modifying the vite.config.js to the following form:
The paths "resources/js/front-end" and "resources/js/front-end//index.js" are specific to my project, in common cases, you can just use "resources/js/" and "resources/js//index.js"
I would like this configuration to be a standard feature of the mingleJs project, as it allows for dynamic rather than static builds, as seen in the mingle-demo example.
Aqui está o vite.config.js
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import vue from "@vitejs/plugin-vue";
import { sync } from "glob";
import path from "path";
let js = sync("resources/js/front-end/**/index.js").map((file) => ({
input: path.relative(
"resources/js/front-end",
file.slice(0, file.length - path.extname(file).length)
),
file: file,
}));
let input = js.map(({ file }) => file);
export default defineConfig({
resolve: {
alias: {
"@mingle": path.resolve(
__dirname,
"vendor/ijpatricio/mingle/resources/js"
),
},
},
plugins: [
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
laravel({
input: ["resources/css/app.css", "resources/js/app.js", ...input],
refresh: true,
}),
],
server: {
cors: true,
},
});
Hello @Felipe-DevT00ls
Sorry for a long delay, I was buried in work, and this wasn't a bug, so I left it for later.
This is a great addition!! How I see it, it shouldn't be a default, because not everyone is using index.js
as the name for the js.
There could be a ChatApp.js
, for example.
The concept is great, though, so I will think of a way of including it, or adapting it to fit all cases.
Thank you so much for the inputs!!
After generating the Vite build, I receive the following error:![image](https://github.com/ijpatricio/mingle/assets/53057957/d3dc882f-ec55-4d96-a14d-e86bd217d92a)
This is the command to generate the Vite build:![image](https://github.com/ijpatricio/mingle/assets/53057957/c31d2e74-583f-45e1-a1c1-a2241ea307c4)
This is my Vite structure:![image](https://github.com/ijpatricio/mingle/assets/53057957/1bd9c686-1e01-4bff-bafb-2daa0c8b5297)
This is my resources/js folder structure:![image](https://github.com/ijpatricio/mingle/assets/53057957/a77aad56-6f23-4345-946b-23e778dfd159)