Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build error when I try to use react-server-router #13

Closed
slajher opened this issue Aug 8, 2024 · 3 comments
Closed

build error when I try to use react-server-router #13

slajher opened this issue Aug 8, 2024 · 3 comments
Assignees

Comments

@slajher
Copy link

slajher commented Aug 8, 2024

based on the documentation I tried to create a simple application using react-server-router
currently my file structure looks like this
image

and I created the server config file as described in the documentation
export default { root: "src/pages", public: "public" };

  • os: windows 10
  • node: 20.11

during the build I get this error message

> react-server build

react-server/0.0.0-experimental-d1c9522-20240723-b0a2206e building server for production
✓ 3 modules transformed.
x Build failed in 90ms
[@lazarv/react-server-router] Could not load virtual:__react_server_router_page__/::C:/home/work/router-test/src/pages/page.tsx::.jsx (imported by virtual:@lazarv/react-server-router/manifest): Cannot read properties of undefined (reading 'module')
    at file:///C:/home/work/router-test/node_modules/.pnpm/@lazarv+react-server-router@0.0.0-experimental-d1c9522-20240723-5933e9de_@lazarv+react-server_ffxmqsrif6izv4qohnj247yhja/node_modules/@lazarv/react-server-router/plugin.mjs:1045:24
    at Array.map (<anonymous>)
    at Object.load (file:///C:/home/work/router-test/node_modules/.pnpm/@lazarv+react-server-router@0.0.0-experimental-d1c9522-20240723-5933e9de_@lazarv+react-server_ffxmqsrif6izv4qohnj247yhja/node_modules/@lazarv/react-server-router/plugin.mjs:1038:20)
    at Object.handler (file:///C:/home/work/router-test/node_modules/.pnpm/vite@6.0.0-alpha.18_@types+node@22.1.0_less@4.2.0_sass@1.77.8_stylus@0.62.0_terser@5.31.4/node_modules/vite/dist/node/chunks/dep-DXWVQosX.js:63867:19)
    at file:///C:/home/work/router-test/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:19892:40
    at async PluginDriver.hookFirstAndGetPlugin (file:///C:/home/work/router-test/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:19792:28)
    at async file:///C:/home/work/router-test/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:18956:33
    at async Queue.work (file:///C:/home/work/router-test/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:20002:32)

ⅹ Build failed in 1.98s
 ELIFECYCLE  Command failed with exit code 1. ```
@lazarv lazarv self-assigned this Aug 8, 2024
@lazarv
Copy link
Owner

lazarv commented Aug 8, 2024

Thanks for reporting @slajher! The router not supported the filename pattern layout.tsx by default, but as it makes sense and helps developers adopting @lazarv/react-server especially when coming from Next.js I added this pattern to the router defaults.

You can always configure the router to include/exclude any patterns when the defaults are not working for you, read more about router configuration at https://react-server.dev/router/configuration.

Please upgrade your @lazarv/react-server-router to the latest version and this should work now out of the box!

@slajher
Copy link
Author

slajher commented Aug 8, 2024

@lazarv thanks for the quick reply and the explanation about the router
after the router upgrade the build works fine with the layout.tsx filename pattern. Thank you!

@slajher slajher closed this as completed Aug 8, 2024
Copy link

github-actions bot commented Sep 9, 2024

This issue has been locked since it has been closed for more than 30 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest version of @lazarv/react-server. If you have any other comments you should create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants