cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.05k stars 3.18k forks source link

Support/switch to SWC #27323

Open 403-html opened 1 year ago

403-html commented 1 year ago

What would you like?

Recently, SWC has garnered substantial attention within the development community, and it has been making remarkable strides in terms of popularity and adoption. Its ability to optimize and transpile JavaScript code at an impressive speed, thanks to its utilization of WebAssembly, sets it apart from conventional pre-processors like Babel.

I would like to propose changing project to use SWC.

Why is this needed?

Speeds up all building and running processes.

Other

No response

nagash77 commented 1 year ago

Hi @403-html , thank you for submitting this feature request. We do not currently have this lined up for work any time in the near future. I just wanted to be upfront about this works priority. For the time being I will route this to our product team for consideration.

lmiller1990 commented 1 year ago

I agree with the concept of moving to something (anything) other than webpack, which showed us how great bundlers can be but is fairly dated and not nearly as fast as it's contemporaries.

I have more experience around esbuild - I would be interested in a proper investigation to see which of these would be a better candidate.

Some related issues:

I don't think this will be part of core anytime soon, it would probably be a big breaking change - it would need to be opt in. You can have most of what you want by authoring a preprocessor - here's one for esbuild that works great.

The best thing to do right now would be create a swc preprocessor (one may already exist) and this would give insight into what would be involved / what kind of complexities you might run into. You can also use it straight away - no need to wait for the Cypress team to review anything.

If you are working on a swc preprocessor, please share it here - I can contribute or help out.

TomasSlama commented 1 year ago

BTW, you can use just SWC loader in webpack so you don't have to rewrite the whole infrastructure.

tbullardcollibra commented 6 months ago

We're using swc-loader with our cypress webpack setup, but I'm having a hard time determining the equivalent of

'@babel/plugin-transform-modules-commonjs',
    {
         loose: true,
    },

so cy.stub() isn't working as expected. If anyone reads this and has any input it's welcome!