-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
60 lines (56 loc) · 1.45 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { defineNuxtConfig } from "nuxt";
requireEnvVars();
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
css: ["@/assets/main.css", "@formkit/themes/genesis"],
autoImports: {
dirs: ["stores"],
},
modules: [
"@formkit/nuxt",
[
"@pinia/nuxt",
{
autoImports: ["defineStore", "acceptHMRUpdate"],
},
],
],
runtimeConfig: {
stripeSecret: process.env.STRIPE_SECRET,
public: {
contentfulSpace: process.env.NUXT_CONTENTFUL_SPACE,
contentfulPublicAccessToken: process.env.NUXT_CONTENTFUL_PUBLIC_ACCESS_TOKEN,
deskreeBaseUrl: process.env.NUXT_DESKREE_BASE_URL,
},
},
build: {
transpile:
process.env.npm_lifecycle_script === "nuxt generate"
? ["contentful"]
: [],
postcss: {
postcssOptions: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
},
},
});
function requireEnvVars() {
const map = {
"Deskree Project URL": process.env.NUXT_DESKREE_BASE_URL,
"Stripe secret token": process.env.STRIPE_SECRET,
};
let ready = true;
for (const label in map) {
if (!map[label]) {
ready = false;
console.error(
`You must provide a ${label} in .env to start the project (see the Setup Guide for more instructions: https://vueschool.notion.site/Preparation-Guide-cf256a7352704d27bb7946c47907d40e)`
);
}
}
if (!ready) process.exit();
}