Skip to content

Instantly share code, notes, and snippets.

@h3ku
Created September 13, 2022 17:24
Show Gist options
  • Save h3ku/1a82585929fb33553bb29d430cecd771 to your computer and use it in GitHub Desktop.
Save h3ku/1a82585929fb33553bb29d430cecd771 to your computer and use it in GitHub Desktop.
@netlify/plugin-nextjs patch to disable IPX
diff --git a/node_modules/@netlify/plugin-nextjs/lib/helpers/edge.js b/node_modules/@netlify/plugin-nextjs/lib/helpers/edge.js
index b6e7a10..60705dc 100644
--- a/node_modules/@netlify/plugin-nextjs/lib/helpers/edge.js
+++ b/node_modules/@netlify/plugin-nextjs/lib/helpers/edge.js
@@ -100,17 +100,6 @@ const writeEdgeFunctions = async (netlifyConfig) => {
};
const edgeFunctionRoot = (0, path_1.resolve)('.netlify', 'edge-functions');
await (0, fs_extra_1.emptyDir)(edgeFunctionRoot);
- if (!process.env.NEXT_DISABLE_EDGE_IMAGES) {
- console.log('Using Netlify Edge Functions for image format detection. Set env var "NEXT_DISABLE_EDGE_IMAGES=true" to disable.');
- const edgeFunctionDir = (0, path_1.join)(edgeFunctionRoot, 'ipx');
- await (0, fs_extra_1.ensureDir)(edgeFunctionDir);
- await copyEdgeSourceFile({ edgeFunctionDir, file: 'ipx.ts', target: 'index.ts' });
- await (0, fs_extra_1.copyFile)((0, path_1.join)('.netlify', 'functions-internal', '_ipx', 'imageconfig.json'), (0, path_1.join)(edgeFunctionDir, 'imageconfig.json'));
- manifest.functions.push({
- function: 'ipx',
- path: '/_next/image*',
- });
- }
if (!process.env.NEXT_DISABLE_NETLIFY_EDGE) {
const middlewareManifest = await (0, exports.loadMiddlewareManifest)(netlifyConfig);
if (!middlewareManifest) {
diff --git a/node_modules/@netlify/plugin-nextjs/lib/index.js b/node_modules/@netlify/plugin-nextjs/lib/index.js
index af0d55b..b373774 100644
--- a/node_modules/@netlify/plugin-nextjs/lib/index.js
+++ b/node_modules/@netlify/plugin-nextjs/lib/index.js
@@ -97,14 +97,6 @@ const plugin = {
netlifyConfig,
nextConfig: { basePath, i18n },
});
- await (0, functions_1.setupImageFunction)({
- constants,
- imageconfig: images,
- netlifyConfig,
- basePath,
- remotePatterns: experimentalRemotePatterns,
- responseHeaders: (0, utils_1.getCustomImageResponseHeaders)(netlifyConfig.headers),
- });
await (0, redirects_1.generateRedirects)({
netlifyConfig,
nextConfig: { basePath, i18n, trailingSlash, appDir },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment