wip avec résolution de conflits
This commit is contained in:
parent
63b2d2b256
commit
ef19ba2b72
208 changed files with 178625 additions and 192002 deletions
|
|
@ -1,63 +0,0 @@
|
|||
import { fdir, PathsOutput } from "fdir";
|
||||
import process from "node:process";
|
||||
import * as v from "valibot";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import valibot from "vite-plugin-valibot-env";
|
||||
|
||||
const SLUG_THEME = "haiku-atelier-2024";
|
||||
const SRC_TYPESCRIPT_PATHS: Promise<PathsOutput> = new fdir()
|
||||
.withBasePath()
|
||||
.filter((path, isDirectory) => !isDirectory && !path.endsWith("d.ts"))
|
||||
.withMaxDepth(0)
|
||||
.crawl(`web/app/themes/${SLUG_THEME}/src/scripts`)
|
||||
.withPromise();
|
||||
const PATHS = await SRC_TYPESCRIPT_PATHS;
|
||||
|
||||
// Voir le fichier vite.env.d.ts.
|
||||
const SCHEMA_ENVIRONNEMENT = v.object({
|
||||
VITE_GLITCHTIP_NSD: v.pipe(v.string(), v.url(), v.readonly()),
|
||||
VITE_MODE: v.pipe(v.string(), v.readonly()),
|
||||
VITE_URL: v.pipe(v.string(), v.nonEmpty(), v.url(), v.readonly()),
|
||||
});
|
||||
|
||||
const basePlugins = [
|
||||
// Permet de valider les variables d'environnements définies à partir d'un schéma Valibot
|
||||
valibot(SCHEMA_ENVIRONNEMENT),
|
||||
];
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), "VITE");
|
||||
console.debug(env);
|
||||
|
||||
return {
|
||||
base: "/",
|
||||
build: {
|
||||
assetsDir: ".",
|
||||
cssMinify: "lightningcss",
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
minify: env["VITE_MODE"] === "production",
|
||||
outDir: "./web/app/themes/haiku-atelier-2024/assets/js",
|
||||
reportCompressedSize: true,
|
||||
rollupOptions: {
|
||||
input: PATHS,
|
||||
output: {
|
||||
assetFileNames: "[hash].[extname]",
|
||||
chunkFileNames: "[hash].js",
|
||||
entryFileNames: "[name].js",
|
||||
minify: env["VITE_MODE"] === "production",
|
||||
},
|
||||
treeshake: true,
|
||||
},
|
||||
sourcemap: env["VITE_MODE"] === "development",
|
||||
target: "es2020",
|
||||
write: true,
|
||||
},
|
||||
css: {
|
||||
devSourcemap: true,
|
||||
transformer: "lightningcss",
|
||||
},
|
||||
mode: env["VITE_MODE"] ?? "production",
|
||||
plugins: [...basePlugins],
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue