Skip to content

Commit 554e979

Browse files
authored
fix(nextjs): Should be able to run custom server targets with swc (nrwl#27526)
## Currently When we installed swc from the Next.js generator it installed an older version that expected version of swc this caused the node & build generator to not work. ## Expected With these changes the version will be in sync with what the `@nx/js:swc` executor is expecting. With that in mind the build should now work as expected and by extension the serve target for custom server as well. fixes: nrwl#27222
1 parent 66ff751 commit 554e979

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

packages/next/src/utils/add-swc-to-custom-server.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import {
66
readJson,
77
updateJson,
88
} from '@nx/devkit';
9-
import { swcCliVersion, swcCoreVersion, swcNodeVersion } from './versions';
9+
import {
10+
swcCliVersion,
11+
swcCoreVersion,
12+
swcNodeVersion,
13+
swcHelpersVersion,
14+
} from '@nx/js/src/utils/versions';
1015
import { addSwcConfig } from '@nx/js/src/utils/swc/add-swc-config';
1116

1217
export function configureForSwc(tree: Tree, projectRoot: string) {
@@ -43,7 +48,9 @@ export function configureForSwc(tree: Tree, projectRoot: string) {
4348
function addSwcDependencies(tree: Tree) {
4449
return addDependenciesToPackageJson(
4550
tree,
46-
{},
51+
{
52+
'@swc/helpers': swcHelpersVersion,
53+
},
4754
{
4855
'@swc-node/register': swcNodeVersion,
4956
'@swc/cli': swcCliVersion,

packages/next/src/utils/versions.ts

-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,3 @@ export const lessLoader = '11.1.0';
77
export const emotionServerVersion = '11.11.0';
88
export const babelPluginStyledComponentsVersion = '1.10.7';
99
export const tsLibVersion = '^2.3.0';
10-
11-
export const swcCliVersion = '~0.1.62';
12-
export const swcCoreVersion = '~1.3.85';
13-
export const swcHelpersVersion = '~0.5.2';
14-
export const swcNodeVersion = '~1.8.0';

0 commit comments

Comments
 (0)