ssr-noexternal-netlify

ssr-noexternal-netlify is a cursor rule for coding agents from dmenchaca/webflow-to-react. It costs 0 tokens per session (724 once invoked), scanned A, original, MIT.

A deployment rule for TanStack Start, a React framework, that fixes server-side rendering failures on Netlify by adding certain packages to Vite's server bundle.

In plain words
What is it for?
Use it to diagnose Netlify function errors, update `web/vite.config.ts`, and run the server-rendering import smoke test before pushing.
Why use it?
It addresses module-loading and missing-dependency crashes that may appear only on the first request to the deployed site, after local build and development checks pass.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/dmenchaca/webflow-to-react/ssr-noexternal-netlify
Clone the repo
git clone --depth 1 https://github.com/dmenchaca/webflow-to-react

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ssr-noexternal-netlify

README.md
[![agentmods](https://agentmods.dev/badge/rules/dmenchaca/webflow-to-react/ssr-noexternal-netlify.svg)](https://agentmods.dev/rules/dmenchaca/webflow-to-react/ssr-noexternal-netlify)
Your own site
<a href="https://agentmods.dev/rules/dmenchaca/webflow-to-react/ssr-noexternal-netlify"><img src="https://agentmods.dev/badge/rules/dmenchaca/webflow-to-react/ssr-noexternal-netlify.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00724
Opus 5 $0.00000 $0.00362
Sonnet 5 $0.00000 $0.00145
Haiku 4.5 $0.00000 $0.00072

Measured 4d ago against content hash 283294ef90ae, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ssr-noexternal-netlify scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/ssr-noexternal-netlify.mdc · 59 lines

How it starts

The opening of the file, as written. The whole thing — 59 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SSR noExternal for Netlify (Webflow → TanStack Start)

These crashes are runtime-only — npm run build and vite dev will not catch them. They surface on the first request to the deployed Netlify function.

When you see it

The Netlify function crash page shows one of:

  • SyntaxError: Cannot use import statement outside a module with node:internal/modules/cjs/loader in the stack — Node tried to load an ESM-only file (e.g. node_modules/<pkg>/index.js) through the CommonJS loader.
  • Error [ERR_REQUIRE_ESM]: require() of ES Module … — a CJS file inside a package called require() on an ESM-only sibling.
  • Error: Cannot find module '<pkg>' with Require stackserver.mjs — Netlify did not trace a transitive dependency into the function bundle. Add <pkg> to ssr.noExternal (same as ESM fixes).

The first stack frame names the file: /var/task/node_modules/<pkg>/<file>. <pkg> is what you add.

Fix

In web/vite.config.ts:

export default defineConfig({
  ssr: {
    noExternal: [
      // Append the package name from the function stack trace.
      // Add transitive deps if subsequent crashes name them.
    ],
  },
  // …plugins
})

Vite then inlines the package into dist/server/assets/routes-*.js, so the Netlify function never reads the raw file and Node's CJS/ESM rules stop applying.

Local SSR smoke test (run after every change to the list)

cd web && npm run build && \
  node -e "import('./.netlify/v1/functions/server.mjs')\
    .then(() => console.log('SSR import OK'))\
    .catch(e => { console.error(e); process.exit(1) })"

If this prints SSR import OK, the same module graph will at least start on Netlify. Run it before every push that changes vite.config.ts, the route components, or the dependency graph.

Per-site discipline

The list is additive and per-site. Different Webflow exports pull in different deps; a fixed list copied between projects either misses the real offender or bloats the SSR bundle.

Read the full file on GitHub · 59 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 59 lines · 0 tokens per session scan A 283294ef90ae

Subscribe to this mod's changes

ssr-noexternal-netlify is a cursor rule published in the GitHub repository dmenchaca/webflow-to-react (27 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 724 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.