@uniweb/build 0.1.6 → 0.1.7
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.
- package/package.json +1 -1
- package/src/prerender.js +4 -2
package/package.json
CHANGED
package/src/prerender.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { readFile, writeFile, mkdir } from 'node:fs/promises'
|
|
9
9
|
import { existsSync } from 'node:fs'
|
|
10
|
-
import { join, dirname } from 'node:path'
|
|
10
|
+
import { join, dirname, resolve } from 'node:path'
|
|
11
11
|
import { pathToFileURL } from 'node:url'
|
|
12
12
|
import { createRequire } from 'node:module'
|
|
13
13
|
|
|
@@ -25,7 +25,9 @@ async function loadDependencies(siteDir) {
|
|
|
25
25
|
|
|
26
26
|
// Create a require function that resolves from the site's perspective
|
|
27
27
|
// This ensures we get the same React instance that the foundation uses
|
|
28
|
-
|
|
28
|
+
// Note: createRequire requires an absolute path
|
|
29
|
+
const absoluteSiteDir = resolve(siteDir)
|
|
30
|
+
const siteRequire = createRequire(join(absoluteSiteDir, 'package.json'))
|
|
29
31
|
|
|
30
32
|
try {
|
|
31
33
|
// Try to load React from site's node_modules
|