-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cypress doesn't work with Webpack 5 #5713
Comments
I confirm that, adding |
I have in fact sometime the error you mention:
But some specs are passing and some not, will try to find out why. |
Cypress hangs on 'tests loading' for me when I force this resolution. But at least the publicPath error is not showing, hah.
Otherwise also getting the issue where some tests are fine other show the Did you find a solution for this? |
@markhus-aurelius as of now I haven't had a chance to find why. I am guessing a library that some of our specs are depending on has a problem when webpack is requiring it. |
I had this issue where some cypress tests passed, while others failed with the error (after the ng12 upgrade):
I found that I was making use of tsconfig paths within my Cypress test classes: import { SbgConstants } from '@sbg-web/common'; If I changed these references to absolute paths. Then everything started working again: // tslint:disable-next-line: nx-enforce-module-boundaries
import { SbgConstants } from '../../../../libs/common/src/lib/constants/sbg-constants'; (Webpack 5 + Cypress) has issues with the tsconfig paths ..? No sure..? Side note: I'm still using Cypress 6.9.1 |
@markhus-aurelius, @ubergeoff we seem to have found a solution by removing the use of preprocessTypescript function provided by Nx and just install the 2 following dev dependencies: since cypress v4.4.0 you don't need any filePreprocessor to use Typescript to write your specs, nonetheless you will need the dependencies listed above. @FrozenPandaz I am pinging you here because I saw this PR that was merged in April, it might be the cause of this issue: cypress-io/cypress#15839 My guess is that maybe the filePreprocessor provided by Nx could be deprecated, there was already a thread about that: #3037 Or we need to find a way to make the publicPath work when using webpack 5. |
Thank you @vincentpalita - yes I can confirm that after installing:
And updating my module.exports = function(on, config) {
//on('file:preprocessor', preprocessTypescript(config));
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}; |
@vincentpalita Absolute legend mate, this got it working for me. Appreciate the help. |
@markhus-aurelius @vincentpalita Do you speak about React applications or Angular applications? If I do what you suggest instead of the publicPath error message I get this one (I suspect it's perhaps because I use Angular?):
If I install |
I am posting here just in case anyone stumbles on this thread because of the error message, even though the cause of the error was different in my case. After upgrading to webpack 5, my react app would not load with the error The issue for me was that I was referencing I fixed it by setting Here is a simplified example: const getWebpackConfig = require('@nrwl/react/plugins/webpack');
module.exports = (config) => {
config = getWebpackConfig(config);
config.output.publicPath = '';
return config;
}; |
Hi there is this still an issue with the latest version of nx? if so feel free to re open 😄 |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
After upgrading to Webpack 5, we get this error:
It seems that you need to update
@cypress/webpack-preprocessor
to latest version.cypress-io/cypress#8900
The text was updated successfully, but these errors were encountered: