82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
import { defineConfig, loadEnv } from 'vite';
|
|
import copy from "rollup-plugin-copy";
|
|
import laravel from 'laravel-vite-plugin';
|
|
import path from "path";
|
|
import react from '@vitejs/plugin-react';
|
|
import eslint from 'vite-plugin-eslint';
|
|
import stylelint from "vite-plugin-stylelint";
|
|
|
|
const env = loadEnv("r", process.cwd(), "");
|
|
const debugMode = env["APP_DEBUG"] === "true";
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
laravel({
|
|
input: [
|
|
// BACK
|
|
'resources/ts/back/app.tsx',
|
|
'resources/sass/back/app.scss',
|
|
// FRONT
|
|
'resources/ts/front/app.ts',
|
|
],
|
|
refresh: true,
|
|
}),
|
|
react(),
|
|
// debugMode &&
|
|
// stylelint({
|
|
// dev: false,
|
|
// build: true,
|
|
// cache: false,
|
|
// include: ['**/resources/**/*.scss', '**/resources/**/*.css'],
|
|
// exclude: ['node_modules', 'vendor', 'packages'],
|
|
// lintOnStart: true,
|
|
// emitError: true,
|
|
// emitWarning: true,
|
|
// emitErrorAsWarning: false,
|
|
// emitWarningAsError: true,
|
|
// }),
|
|
// debugMode &&
|
|
// eslint({
|
|
// cache: false,
|
|
// include: ['resources/ts/**/*.{ts,tsx}'],
|
|
// exclude: ['node_modules', 'vendor', 'packages'],
|
|
// lintOnStart: true,
|
|
// emitWarning: true,
|
|
// emitError: true,
|
|
// failOnWarning: false,
|
|
// failOnError: true,
|
|
// }),
|
|
copy({
|
|
targets: [
|
|
{
|
|
src: [
|
|
path.normalize("resources/favicon/back/*"),
|
|
"!" + path.normalize("resources/favicon/back/.gitkeep"),
|
|
],
|
|
dest: path.normalize("public/favicon-back")
|
|
},
|
|
{
|
|
src: [
|
|
path.normalize("resources/favicon/front/*"),
|
|
"!" + path.normalize("resources/favicon/front/.gitkeep"),
|
|
],
|
|
dest: path.normalize("public/")
|
|
},
|
|
],
|
|
copyOnce: true,
|
|
verbose: true
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: [
|
|
{
|
|
find: "&",
|
|
replacement: "/resources/assets",
|
|
},
|
|
{
|
|
find: "@",
|
|
replacement: "/resources/ts",
|
|
},
|
|
],
|
|
},
|
|
});
|