ldc-agis/vite.config.ts
2023-10-23 10:09:45 +02:00

124 lines
3.6 KiB
TypeScript

import basicSsl from "@vitejs/plugin-basic-ssl";
import vue from "@vitejs/plugin-vue";
import laravel from "laravel-vite-plugin";
import postcssDiscard from "postcss-discard-comments";
import { defineConfig } from "vite";
import babel from "vite-plugin-babel";
import checker from "vite-plugin-checker";
import eslint from "vite-plugin-eslint";
import stylelint from "vite-plugin-stylelint";
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]`,
},
},
emptyOutDir: true,
sourcemap: process.env.NODE_ENV === "local" ? "inline" : false,
},
css: {
devSourcemap: process.env.NODE_ENV === "local" ? true : false,
postcss: {
map: {
inline: true,
},
plugins: [
postcssDiscard({
removeAll: true,
}),
],
},
},
plugins: [
basicSsl(),
checker({
enableBuild: true,
vueTsc: {
root: ".",
tsconfigPath: "tsconfig.json",
},
typescript: {
root: ".",
tsconfigPath: "tsconfig.json",
},
eslint: {
lintCommand:
"eslint --quiet -c .eslintrc.json \"./resources/ts/*\"",
},
stylelint: {
lintCommand:
"stylelint --quiet, -c .stylelintrc.json --fix **/resources/**/*.scss",
},
}),
laravel({
input: [
"resources/sass/bo/bo.scss",
"resources/ts/bo/bo.ts",
"resources/sass/fo/fo.scss",
"resources/ts/fo/fo.ts",
],
refresh: true,
}),
stylelint({
dev: false,
build: true,
cache: false,
chokidar: true,
include: ["**/resources/**/*.scss", "**/resources/**/*.css"],
exclude: ["node_modules", "vendor"],
lintOnStart: false,
emitError: true,
emitWarning: true,
emitErrorAsWarning: false,
emitWarningAsError: true,
}),
eslint({
cache: false,
extensions: ["js", "ts"],
include: "**/*.ts",
exclude: ["node_modules", "vendor"],
lintOnStart: false,
emitWarning: true,
emitError: true,
failOnWarning: false,
failOnError: false,
}),
babel({
babelConfig: {
targets: "last 3 version, not dead, >0.3%"
}
}),
vue({
isProduction: process.env.NODE_ENV !== "local" ? true : false,
exclude: ["node_modules", "vendor"],
})
],
server: {
watch: {
usePolling: true,
},
},
resolve: {
extensions: ["*", ".js", ".ts", ".vue"],
alias: [
{
find: "vue",
replacement: "vue/dist/vue.runtime.esm-bundler.js",
},
{
find: "@",
replacement: "/resources/assets",
}
],
},
});