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: remove webpack entrypoints from for ct webpack projects #23299

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

ZachJW34
Copy link
Contributor

User facing changelog

Webpack entrypoints are no longer preserved for CT Webpack projects

Additional details

Fixes a regression from #22314 where webpack entrypoints were being preserved. This is mostly a revert of the changes made to entrypoints in that PR. It made sense for frameworks as their was logic added for removing entrypoints that would cause problems in each handler, but users who pass in a custom webpack config (don't use a higher-order framework like Next or create-react-app) were facing issues with their entrypoint being included and executed.

Steps to test

Checkout the repo provided in the original issue: https://gitlab.com/souf/react-webpack-playground/-/tree/cypress-webpack-entry

Install Cypress and walk through CT setup.

Create a simple spec:

// src/components/App.cy.jsx
import React from "react";
import App from "./App";

it("should render", () => {
  cy.mount(<App />);
});

Then run the spec. Nothing will load, and the console will display:

Screen Shot 2022-08-11 at 5 09 20 PM

Checkout my branch and run yarn workspace @cypress/webpack-dev-server build && yarn cypress:open. Open the same project and no more error!

How has the user experience changed?

Screen.Recording.2022-08-11.at.5.15.33.PM.mov

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

@ZachJW34 ZachJW34 requested a review from a team as a code owner August 11, 2022 22:18
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 11, 2022

Thanks for taking the time to open a PR!

Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question/comment. This must go in the next release!

@@ -17,8 +17,6 @@ export function vueCliHandler (devServerConfig: WebpackDevServerConfig): PresetH

debug('webpack config %o', webpackConfig)

delete webpackConfig.entry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of deleting it in many places, and then having to remember this if we implement a new webpack handler, any chance we could lift this up higher and do something like

if (!angular) {
  delete webpackConfig.entry
}

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is doing exactly that. In #22314 I moved entry handling to each handler. This PR reverts those changes so that the handlers don't have to worry about entrypoints since they will be replaced with the Cypress entry here

The line you referenced is a removal, not an addition (unless I'm misunderstanding your comment)

@astone123 astone123 self-requested a review August 12, 2022 15:21
Copy link
Contributor

@astone123 astone123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this with the example project and these changes resolve the webpack entrypoint issue 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Components testing - Webpack entry feature causes confusion
4 participants