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

fix(react): ssr should serve correctly and e2e should function #17725

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

Coly010
Copy link
Contributor

@Coly010 Coly010 commented Jun 22, 2023

Current Behavior

E2E and Serve of React SSR apps not functioning correctly.

The ssr-dev-server is not receiving build options from the js/node executor to be able to determine when the server has been started successfully.
Therefore, it can never set itself to a ready state.

This prevents cypress from being able to run.

The webpack executor also looks for the entry point based on outputFileName or else it will default to main.js.
The node executor finds the entry point based on main in build options.

Webpack executor is outputting main.js as the entrypoint, however, node executor is looking for server.js as the main option is server.ts.

The setup-ssr generator does not set an outputFileName. Make it set an outputFileName to ensure consistency and behaviour.
If user's want to change the name of the filename that is output, they can change this option and both executors will still function in unison.

Expected Behavior

Serving SSR and e2es should work.
setup-ssr generator should set an outputFileName

Related Issue(s)

Fixes #17723 #17706

@Coly010 Coly010 requested review from a team as code owners June 22, 2023 13:01
@Coly010 Coly010 requested a review from jaysoo June 22, 2023 13:01
@Coly010 Coly010 self-assigned this Jun 22, 2023
@vercel
Copy link

vercel bot commented Jun 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 22, 2023 1:03pm

@nx-cloud
Copy link

nx-cloud bot commented Jun 22, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 5ed18c3. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@Coly010 Coly010 enabled auto-merge (squash) June 22, 2023 13:33
@Coly010 Coly010 merged commit fffd84c into nrwl:master Jun 22, 2023
@Coly010 Coly010 deleted the webpack/fix-ssr-serve branch June 22, 2023 13:52
@ojemuyiwa
Copy link

Hi @Coly010 Sadly this doesn't work out of the box, neither does setting outputFileName: "server.ts", "dist/parameter-manager/server/main.js" etc. Used to work out of the box but doesn't work. changing e2e to serve-static works but this doesn’t. 😔
Thanks for looking into it though

@Coly010
Copy link
Contributor Author

Coly010 commented Jun 22, 2023

There's more than just changing the output file name happening here.

I have tested it out of the box and can confirm it works. What issue are you seeing?

@ojemuyiwa
Copy link

create workspace
Standalone react app
react framework none
CSS
Webpack
No distributed cache
generate SSR

when you run the auto generated e2e it doesn't work
webpack 5.87.0 compiled successfully (47eed2b4abafa82e) Type-checking in progress... No errors found. Debugger listening on ws://localhost:9229/bae8a966-8180-425f-9609-270786579072 Debugger listening on ws://localhost:9229/bae8a966-8180-425f-9609-270786579072 For help, see: https://nodejs.org/en/docs/inspector

@ojemuyiwa
Copy link

create workspace Standalone react app react framework none CSS Webpack No distributed cache generate SSR

when you run the auto generated e2e it doesn't work webpack 5.87.0 compiled successfully (47eed2b4abafa82e) Type-checking in progress... No errors found. Debugger listening on ws://localhost:9229/bae8a966-8180-425f-9609-270786579072 Debugger listening on ws://localhost:9229/bae8a966-8180-425f-9609-270786579072 For help, see: https://nodejs.org/en/docs/inspector

I.e. cypress does not launch

@Coly010
Copy link
Contributor Author

Coly010 commented Jun 22, 2023

Yes, this will fix that. The fix hasn't been released yet. It will be released soon with 16.4 of Nx

@ojemuyiwa
Copy link

Yes, this will fix that. The fix hasn't been released yet. It will be released soon with 16.4 of Nx

Hi 👋 sadly no dice on the e2e running with new release

@github-actions
Copy link

github-actions bot commented Jul 2, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

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

Successfully merging this pull request may close these issues.

nx e2e broken on default run
3 participants