ldc-showroom/nuxt.config.ts
2024-01-18 11:19:17 +01:00

91 lines
2.9 KiB
TypeScript

import { resolve } from "path";
import UnzipData from "./electron/UnzipData";
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
hooks: {
"build:before": () => {
if (process.env.npm_lifecycle_event === "typecheck") {
return;
}
if (!UnzipData.loadZipFileContent()) {
throw new Error("No zip file to load");
}
}
},
experimental: {
polyfillVueUseHead: false
},
components: [
{ path: "~/components", pathPrefix: false }
],
imports: {
dirs: ["stores", "composables"],
},
// * @pinia/nuxt doit être le dernier dans la liste (source stackoverflow)
modules: ["nuxt-electron", "@nuxtjs/i18n", "@pinia/nuxt"],
electron: {
build: [
{
// Main-Process entry file of the Electron App.
entry: "electron/main.ts"
},
{
entry: "electron/preload.ts",
onstart(args) {
// Notify the Renderer-Process to reload the page when the Preload-Scripts build is complete,
// instead of restarting the entire Electron App.
args.reload();
},
},
],
renderer: {},
},
nitro: {
output: {
publicDir: resolve(__dirname, "./build")
}
},
devtools: { enabled: false },
app: {
pageTransition: { name: "page", mode: "out-in" },
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: "showroom",
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "description", name: "description", content: "" },
{ name: "format-detection", content: "telephone=no" },
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
bodyAttrs: {
"data-bs-theme": "light"
}
},
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: ["~/assets/scss/style.scss", "@fortawesome/fontawesome-svg-core/styles.css"],
plugins: [
{ src: "~/plugins/toolboxhelper.ts", mode: "client" },
{ src: "~/plugins/boostrap.ts", mode: "client" },
{ src: "~/plugins/fontawesome.ts", mode: "client" },
{ src: "~/plugins/localStorage.ts", mode: "client" },
{ src: "~/plugins/emitter.ts", mode: "client" },
],
alias: {
// images: resolve(__dirname, "./static/assets/images"),
data: resolve(__dirname, "./static/data"),
pinia: "/node_modules/@pinia/nuxt/node_modules/pinia/dist/pinia.mjs"
},
i18n: {
locales: ["en", "fr", "nl"],
defaultLocale: "fr",
// * Ajouter aussi la locale dans ce fichier
vueI18n: "./i18n.config.ts"
}
});