-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: get next config before requiring devserver #15885
Conversation
Thanks for taking the time to open a PR!
|
Thanks for this, this takes at least me much closer to the goal! I just want to point out though that it still seems to be issues when setting With these changes a project with But if I change to It starts Cypress properly. But I get an infinite loading indicator and in the console I see these two errors:
As mentioned it might be unrelated but just wanted to point it out. For reference here's my test file: import { mount } from '@cypress/react';
import { useState } from 'react';
const Button: React.FC<any> = (props) => <button {...props} />;
const TestComponent = () => {
const [count, setCount] = useState(0);
return (
<div>
<Button onClick={() => setCount(count - 1)}>-</Button>
<output>{count}</output>
<Button onClick={() => setCount(count + 1)}>+</Button>
</div>
);
};
it('invokes onClick handlers', () => {
mount(<TestComponent />);
cy.findByRole('status').should('have.text', '0');
cy.findByRole('button', { name: '+' }).click();
cy.findByRole('status').should('have.text', '1');
cy.findByRole('button', { name: '-' }).click();
cy.findByRole('status').should('have.text', '0');
}); |
The lazy compilation issue should be fixed soon. As should the requirement to install html-webpack-plugin. We had to fork/import lazy-compile-webpack-plugin because it wasn't being maintained... however... that plugin should only be valid if you're using webpack 4. Webpack 5 has lazy compilation built in under a feature flag here Can you send me an example repository @adambrgmn and I can test this PR against the latest versions of each? We're also putting together some system tests so make sure we test against a matrix of project configurations. That will help ensure we don't regress with these build setups. |
Yeah our nextjs configuration is not working because, like you saw @adambrgmn, our browser.js entrypoint isn't being hosted by next. I'm not sure why browser.js isn't being hosted... we mark it as an I'm going to merge this PR in @djsilcock because it doesn't regress. |
User facing changelog
Uses nextjs instance of webpack for webpack devserver
Additional details
NextJs uses its own bundled version of webpack instead of having it as a [peer] dependency, and adds a require hook such that calls to
require('webpack')
resolve to this bundled version. This moves therequire('@cypress/webpack-dev-server')
to after the next webpack hook has been set up, so the webpack setup proceeds as planned.Note that projects should not require to list webpack as a dependency for this plugin to work
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?