ldc-wenn-dann-mit-respekt/vite.config.ts

126 lines
3.8 KiB
TypeScript
Raw Permalink Normal View History

2023-03-15 10:31:55 +01:00
import { defineConfig } from "vite";
import checker from "vite-plugin-checker";
import eslint from "vite-plugin-eslint";
import laravel from "laravel-vite-plugin";
import legacy from "@vitejs/plugin-legacy";
import path from "path";
import stylelint from "vite-plugin-stylelint";
import vue from "@vitejs/plugin-vue";
export default defineConfig({
build: {
rollupOptions: {
output: {
entryFileNames: `assets/${
process.env.NODE_ENV === "local" ? "[name]-" : ""
}[hash].js`,
chunkFileNames: `assets/${
process.env.NODE_ENV === "local" ? "[name]-" : ""
}[hash].js`,
assetFileNames: `assets/${
process.env.NODE_ENV === "local" ? "[name]-" : ""
}[hash].[ext]`,
},
},
chunkSizeWarningLimit: 700,
2023-03-15 10:31:55 +01:00
emptyOutDir: true,
sourcemap: process.env.NODE_ENV === "local" ? "inline" : false,
},
css: {
devSourcemap: process.env.NODE_ENV === "local" ? true : false,
postcss: {
map: {
inline: true,
},
plugins: [
require("postcss-discard-comments")({
removeAll: true,
}),
require("tailwindcss")("./tailwind.config.js"),
2023-03-15 10:31:55 +01:00
],
},
},
plugins: [
checker({
2023-06-01 16:21:41 +02:00
enableBuild: true,
2023-03-15 10:31:55 +01:00
vueTsc: {
root: ".",
tsconfigPath: "tsconfig.json",
},
typescript: {
root: ".",
tsconfigPath: "tsconfig.json",
},
eslint: {
lintCommand:
"eslint --fix --quiet -c .eslintrc.json \"./resources\"",
},
stylelint: {
lintCommand:
"stylelint -q --config \"./.stylelintrc.json\" --fix \"**/resources/**/*.scss\"",
},
}),
laravel({
input: [
"resources/sass/bo/bo.scss",
"resources/ts/bo.ts",
"resources/sass/fo/fo.scss",
"resources/ts/fo.ts",
],
}),
stylelint({
dev: false,
build: true,
cache: false,
chokidar: true,
quiet: false,
include: ["**/resources/**/*.scss", "**/resources/**/*.css"],
exclude: [
"**/node_modules/**/*.scss",
"**/node_modules/**/*.css",
"**/vendor/**/*.scss",
"**/vendor/**/*.css",
],
2023-06-01 16:21:41 +02:00
lintOnStart: false,
2023-03-15 10:31:55 +01:00
emitError: true,
emitWarning: true,
emitErrorAsWarning: false,
emitWarningAsError: true,
}),
eslint({
cache: false,
extensions: ["js", "ts"],
include: "**/*.ts",
2023-06-01 16:21:41 +02:00
lintOnStart: false,
2023-03-15 10:31:55 +01:00
emitWarning: true,
emitError: true,
failOnWarning: false,
failOnError: false,
}),
vue({
isProduction: process.env.NODE_ENV !== "development" ? true : false,
}),
legacy({
targets: "last 3 version, not dead, >0.3%",
renderLegacyChunks: false,
}),
],
resolve: {
extensions: ["*", ".js", ".ts", ".vue"],
alias: [
{
find: "vue",
replacement: "vue/dist/vue.runtime.esm-bundler.js",
},
{
find: "@",
replacement: "/resources/assets",
},
{
find: "~",
replacement: path.resolve(__dirname, "./node_modules"),
},
],
},
});