salesforce/lwc

"Could not determine component name from file path" when compiling a module for SSR

Closed this issue · 1 comments

Description

Steps to Reproduce

See lwc#2400 here.

In this PR, we are integrating the @lwc/ssr-compiler into LWR-Node for TD-0205202. We started passing TransformOptions.targetSSR = true into @lwc/compiler#transformSync.

  1. Clone the lwr repo
  2. Checkout the laura/ssr-compiler branch
  3. yarn (install + build)
  4. yarn ssr:start
  5. Visit http://localhost:4000

Expected Results

The LWC modules are compiled for SSR.

Actual Results

The @lwc/ssr-compiler cannot parse the filename passed to it:

[error] LWR Diagnostic Error: An unexpected error occurred: "Could not determine component name from file path: /Users/lpomerleau/git/lwr/packages/test-apps/lwr-ssr-app/src/modules/demo/localeSelector/localeSelector.ts"

Error is being thrown here.

Browsers Affected

Node.js

Version

Node project
package.json
"peerDependencies": { "@lwc/compiler": ">= 2.x" }
"devDependencies": { "@lwc/compiler": "7.2.6" }

  • LWC: 7.2.6

Possible Solution

Is LWR-Node passing in a bad filename? We pass the same filenames to the @lwc/compiler, but maybe the SSR compiler has different requirements.

Fixed by #4567, see also this PR.