Skip to content

fix: remove swc binaries #681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 8, 2021
Merged
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
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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,
Expand Down