@timber-js/app 0.2.0-alpha.88 → 0.2.0-alpha.89

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timber-js/app",
3
- "version": "0.2.0-alpha.88",
3
+ "version": "0.2.0-alpha.89",
4
4
  "description": "Vite-native React framework built for Servers and Serverless Platforms — correct HTTP semantics, real status codes, pages that work without JavaScript",
5
5
  "keywords": [
6
6
  "cloudflare-workers",
@@ -8,6 +8,7 @@
8
8
  * Design doc: 18-build-system.md
9
9
  */
10
10
 
11
+ import { createRequire } from 'node:module';
11
12
  import type { TimberUserConfig } from './config-types.js';
12
13
 
13
14
  // ─── Types ──────────────────────────────────────────────────────────────────
@@ -262,11 +263,14 @@ const REQUIRED_PEERS = ['react', 'react-dom', '@vitejs/plugin-react', '@vitejs/p
262
263
  export function checkPeerDependencies(projectRoot: string): PeerDepResult[] {
263
264
  const results: PeerDepResult[] = [];
264
265
 
266
+ // Use createRequire from the project root to resolve as the user would.
267
+ // `createRequire` MUST be a top-level ESM import — inline `require('node:module')`
268
+ // throws "Dynamic require not supported" in ESM and the catch below would
269
+ // mark every peer as missing. Same class of bug as TIM-796.
270
+ const userRequire = createRequire(`${projectRoot}/package.json`);
271
+
265
272
  for (const name of REQUIRED_PEERS) {
266
273
  try {
267
- // Use createRequire from the project root to resolve as the user would
268
- const { createRequire } = require('node:module');
269
- const userRequire = createRequire(`${projectRoot}/package.json`);
270
274
  userRequire.resolve(name);
271
275
  results.push({ name, status: 'ok' });
272
276
  } catch {