From 9f099126698fd12bc7e4e37fe5e115eecbd246e8 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Fri, 8 Oct 2021 15:14:51 +0100 Subject: [PATCH 1/2] fix: remove swc binaries --- index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/index.js b/index.js index 71b71b2b9c..e8ed059c92 100644 --- a/index.js +++ b/index.js @@ -125,6 +125,15 @@ See https://ntl.fyi/remove-plugin for instructions. publishDir: netlifyConfig.build.publish || PUBLISH_DIR, nextRoot, }) + + if (!netlifyConfig.functions['*'].included_files) { + // eslint-disable-next-line no-param-reassign + netlifyConfig.functions['*'].included_files = [] + } + netlifyConfig.functions['*'].included_files.push( + '!node_modules/@next/swc-*/**/*', + '!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*', + ) }, async onPostBuild({ netlifyConfig, packageJson, constants: { FUNCTIONS_DIST = DEFAULT_FUNCTIONS_DIST }, utils }) { From f066c8304a9c1b243fd108885b39b6adb5a45058 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Fri, 8 Oct 2021 15:29:09 +0100 Subject: [PATCH 2/2] fix: update test --- test/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/index.js b/test/index.js index e50ea74d94..70f69f612d 100644 --- a/test/index.js +++ b/test/index.js @@ -87,7 +87,7 @@ afterEach(async () => { }) const DUMMY_PACKAGE_JSON = { name: 'dummy', version: '1.0.0', scripts: { build: 'next build' } } -const netlifyConfig = { build: { command: 'npm run build' } } +const netlifyConfig = { build: { command: 'npm run build' }, functions: { '*': {} } } describe('preBuild()', () => { test('fails if the build version is too old', () => { @@ -307,7 +307,7 @@ describe('onBuild()', () => { await moveNextDist() const PUBLISH_DIR = 'publish' await plugin.onBuild({ - netlifyConfig: { build: { publish: path.resolve(PUBLISH_DIR), command: 'next build' } }, + netlifyConfig: { ...netlifyConfig, build: { publish: path.resolve(PUBLISH_DIR), command: 'next build' } }, packageJson: DUMMY_PACKAGE_JSON, constants: { PUBLISH_DIR,