Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next-codemod/bin/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export async function runTransform(
if (verbose) {
args.push('--verbose=2')
}
args.push('--no-babel')
args.push('--parser=tsx')

args.push('--ignore-pattern=**/node_modules/**')
args.push('--ignore-pattern=**/.next/**')
Expand Down
5 changes: 5 additions & 0 deletions packages/next-codemod/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ export const TRANSFORMER_INQUIRER_CHOICES = [
value: 'app-dir-runtime-config-experimental-edge',
version: '15.0.0-canary.179',
},
{
title: 'Updates `next.config.js` to use the new `turbopack` configuration',
value: 'next-experimental-turbo-to-turbopack',
version: '10.0.0',
},
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// CommonJS configuration with variable declaration first
const config = {
experimental: {
turbo: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
},
memoryLimit: 4096,
minify: true,
treeShaking: false,
sourceMaps: true
},
serverActions: true,
typedRoutes: false
},
images: {
formats: ['image/avif', 'image/webp']
}
};

module.exports = config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// CommonJS configuration with variable declaration first
const config = {
experimental: {
serverActions: true,
typedRoutes: false,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
},

images: {
formats: ['image/avif', 'image/webp']
},

turbopack: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
}
}
};

module.exports = config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
experimental: {
turbo: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
},
memoryLimit: 4096,
minify: true,
treeShaking: false,
sourceMaps: true
},
serverActions: true,
typedRoutes: false,
},
images: {
formats: ['image/avif', 'image/webp'],
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
experimental: {
serverActions: true,
typedRoutes: false,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
},

images: {
formats: ['image/avif', 'image/webp'],
},

turbopack: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
experimental: {
turbo: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
},
memoryLimit: 4096,
minify: true,
treeShaking: false,
sourceMaps: true
},
serverActions: true,
typedRoutes: false,
},
images: {
formats: ['image/avif', 'image/webp'],
},
}

module.exports.turbopack.resolveAlias.chai = {
browser: 'chai/chai.js',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
experimental: {
serverActions: true,
typedRoutes: false,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
},

images: {
formats: ['image/avif', 'image/webp'],
},

turbopack: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
}
}
}

module.exports.turbopack.resolveAlias.chai = {
browser: 'chai/chai.js',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// CommonJS configuration with variable declaration and modification
const config = {
experimental: {
turbo: {
resolveAlias: {
underscore: 'lodash',
},
memoryLimit: 4096,
},
typedRoutes: true,
},
};

// Add additional configuration before export
config.images = {
formats: ['image/avif', 'image/webp']
};

// Add more to turbo config
config.experimental.turbo.sourceMaps = true;

module.exports = config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// CommonJS configuration with variable declaration and modification
const config = {
experimental: {
typedRoutes: true,
turbopackMemoryLimit: 4096,
},

turbopack: {
resolveAlias: {
underscore: 'lodash',
}
}
};

// Add additional configuration before export
config.images = {
formats: ['image/avif', 'image/webp']
};

// Add more to turbo config
config.experimental.turbopackSourceMaps = true;

module.exports = config;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const x = 3;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const x = 3;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// CommonJS with object property assignment
const config = {
experimental: {
turbo: {
resolveAlias: {
underscore: 'lodash',
}
},
typedRoutes: true,
},
};

// Add properties to the turbo object
config.experimental.turbo.resolveAlias.foo = 'bar';
config.experimental.turbo.minify = true;
config.experimental.turbo.memoryLimit = 4096;

// Add regular property
config.images = {
formats: ['image/avif', 'image/webp'],
};

module.exports = config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// CommonJS with object property assignment
const config = {
experimental: {
typedRoutes: true
},

turbopack: {
resolveAlias: {
underscore: 'lodash',
}
}
};

// Add properties to the turbo object
config.turbopack.resolveAlias.foo = 'bar';
config.experimental.turbopackMinify = true;
config.experimental.turbopackMemoryLimit = 4096;

// Add regular property
config.images = {
formats: ['image/avif', 'image/webp'],
};

module.exports = config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { NextConfig } from 'next';

const config = {
experimental: {
turbo: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
},
memoryLimit: 4096,
minify: true,
treeShaking: false,
sourceMaps: true,
},
typedRoutes: true,
},
images: {
formats: ['image/avif', 'image/webp'],
},
} as const;

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { NextConfig } from 'next';

const config = {
experimental: {
typedRoutes: true,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
},

images: {
formats: ['image/avif', 'image/webp'],
},

turbopack: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
}
}
} as const;

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { NextConfig } from "next";

const nextConfig = {
experimental: {
mdxRs: true,
turbo: {
rules: {
"*.react.svg": {
loaders: ["@svgr/webpack"],
as: "*.js",
},
},
},
},
// Other config properties
webpack(config) {
return config;
},
} satisfies NextConfig;

const withMDX = require("@next/mdx")();
export default withMDX(nextConfig);
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { NextConfig } from "next";

const nextConfig = {
experimental: {
mdxRs: true
},

// Other config properties
webpack(config) {
return config;
},

turbopack: {
rules: {
"*.react.svg": {
loaders: ["@svgr/webpack"],
as: "*.js",
},
}
}
} satisfies NextConfig;

const withMDX = require("@next/mdx")();
export default withMDX(nextConfig);
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { NextConfig } from "next";

const nextConfig = {
experimental: {
mdxRs: true,
turbo: {
rules: {
"*.react.svg": {
loaders: ["@svgr/webpack"],
as: "*.js",
},
},
},
},
// Other config properties
webpack(config) {
return config;
},
} satisfies NextConfig;

export default nextConfig;
Loading