@bouygues-telecom/staticjs 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ async function createReactPowerStatic(projectName) {
16
16
  await downloadTemplate(`github:BouyguesTelecom/static.js/templates/react#main`, {
17
17
  force: true,
18
18
  offline: false,
19
+ preferOffline: false,
19
20
  provider: "github",
20
21
  cwd: dest,
21
22
  dir: `.`,
@@ -4,6 +4,18 @@
4
4
  */
5
5
  import * as path from "node:path";
6
6
  import * as fs from "node:fs";
7
+ import { loadEnv } from "vite";
8
+ // Load environment variables from .env files into process.env
9
+ // This ensures server-side code (like getStaticProps) can access env vars
10
+ const projectRoot = path.resolve(process.cwd());
11
+ const mode = process.env.NODE_ENV || 'development';
12
+ const env = loadEnv(mode, projectRoot, '');
13
+ // Merge loaded env vars into process.env (without overwriting existing vars)
14
+ for (const [key, value] of Object.entries(env)) {
15
+ if (process.env[key] === undefined) {
16
+ process.env[key] = value;
17
+ }
18
+ }
7
19
  /**
8
20
  * Type validators for each config key
9
21
  * Keys in this object define the whitelist of allowed configuration keys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bouygues-telecom/staticjs",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "./_build/server/index.js",
6
6
  "exports": {