Skip to content

sm new module: AssemblyName (SimpleModule.<Name>) != dir basename (<Name>), so the Vite pages bundle 404s #228

Closed

Description

@antosubash

Summary

sm new module <Name> sets <AssemblyName>SimpleModule.<Name></AssemblyName> but places the server project in a directory whose basename is <Name>. When you add a frontend, the Vite bundle name (derived from the directory basename) and the RCL serve path (derived from the assembly name) disagree, so the page bundle 404s and the module's pages never load.

Detail

sm new module Customers →

  • project dir: src/modules/Customers/src/Customers
  • Customers.csproj: <AssemblyName>SimpleModule.Customers</AssemblyName>

After adding Pages/index.ts + vite.config.ts (export default defineModuleConfig(import.meta.dirname)):

  • defineModuleConfig sets fileName: () => \${basename(dir)}.pages.js` → **Customers.pages.js**, output to wwwroot/`.
  • An RCL serves wwwroot/ under /_content/<AssemblyName>/ → /_content/SimpleModule.Customers/Customers.pages.js.
  • Client resolvePage tries /_content/Customers/Customers.pages.js then /_content/SimpleModule.Customers/SimpleModule.Customers.pages.js.

None of those match the actual served path → 404 → Page "..." not found / blank page.

Suggested fix

Make the generated AssemblyName (and RootNamespace) equal the directory basename — e.g. Customers — so the bundle (Customers.pages.js) serves at /_content/Customers/ and resolvePage hits on the first candidate. (Alternatively, scaffold the directory as SimpleModule.<Name> to match the assembly, but bare names are nicer for downstream apps and are what resolvePage tries first.)

Severity

Medium — every scaffolded module that adds React pages.

Workaround

Set <AssemblyName> / <RootNamespace> to the bare module name.

Environment

  • sm CLI 0.0.37, @simplemodule/client 0.0.38, .NET SDK 10.0.202, Linux.

Activity

  1. antosubash commented on Jun 3, 2026

    @antosubash
    OwnerAuthor

    Fixed in #231 (merged db8be0e). Verified the fix is present on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcli

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions