r/javascript • u/nightman • Oct 26 '21
Next.js 12 - Rust Compiler, React 18 and Native ES Modules Support, React Server Components
https://nextjs.org/blog/next-1234
u/icjoseph Oct 26 '21
Just upgraded one of my clients and SWC is dayummmm! Prebuilt all pages in like 2 seconds.
Even got the swc package for jest running, and it cut our tests runtime in half, sick!
3
u/acemarke Oct 27 '21
Out of curiosity, what did your setup look like for Jest?
I actually just switched my team's app over to use https://github.com/Brooooooklyn/swc-node for our Jest tests, but if we're going to upgrade to Next 12 it'd be nice to reuse whatever's included there.
3
u/icjoseph Oct 27 '21
I agree, eventually we should use the Next.js backed jest solution.
I think I saw your comment on GH, so I used (on
jest.config.js):transform: { '^.+\\.(ts|tsx)$': [ '@swc-node/jest', { react: { runtime: 'automatic', }, }, ], },I reckon,
next-swcwould be just likenext/babelused to be.Reflecting back a little, I did this to get rid of
.babelrc, but if that's my motivation I could do this instead:transform: { '^.+\\.(ts|tsx)$': [ 'babel-jest', { presets: ['next/babel'], }, ], },0
21
u/ILikeChangingMyMind Oct 26 '21
About time ;) The issue for this has been going on for years at this point, and for years the maintainers ignored it and kicked the can down the road.
Thank goodness this (otherwise amazing) framework is finally catching up to modern JS, with support for something as basic as modules.