Skip to content

Commit

Permalink
chore(nextjs): fix babel migration for nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Mar 10, 2021
1 parent 0b7e057 commit 4fe4656
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ describe('Migrate babel setup', () => {
root: 'apps/app5',
projectType: 'application',
},
app6: {
root: 'apps/app6',
projectType: 'application',
},
lib1: {
root: 'libs/lib1',
projectType: 'library',
Expand All @@ -49,6 +53,7 @@ describe('Migrate babel setup', () => {
app3: {},
app4: {},
app5: {},
app6: {},
lib1: {},
},
})
Expand All @@ -72,6 +77,10 @@ describe('Migrate babel setup', () => {
'apps/app4/.babelrc',
JSON.stringify({ presets: ['@nrwl/gatsby/babel'] })
);
tree.write(
'apps/app5/.babelrc',
JSON.stringify({ presets: ['@nrwl/next/babel'] })
);

await updateBabelConfig(tree);

Expand All @@ -97,6 +106,10 @@ describe('Migrate babel setup', () => {

expect(tree.exists('apps/app5/.babelrc')).not.toBeTruthy();

expect(readJson(tree, 'apps/app5/.babelrc')).toMatchObject({
presets: ['@nrwl/next/babel'],
});

expect(readJson(tree, 'libs/lib1/.babelrc')).toMatchObject({
presets: ['@nrwl/web/babel'],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function updateBabelConfig(host: Tree) {
(x) =>
x === '@nrwl/web/babel' ||
x === '@nrwl/react/babel' ||
x === '@nrwl/next/babel' ||
x === '@nrwl/gatsby/babel'
)
) {
Expand Down

0 comments on commit 4fe4656

Please sign in to comment.