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
20 changes: 20 additions & 0 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,26 @@ jobs:
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/6 -c 3
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testIntegrationWithoutSharp:
name: Test Integration (without sharp)
runs-on: ubuntu-latest
needs: testIntegration
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
HEADLESS: true
steps:
- uses: actions/cache@v2
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

# TODO: remove after we fix watchpack watching too much
- run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- run: rm -rf node_modules/sharp
- run: xvfb-run node run-tests.js --timings test/integration/cli/test/index.test.js -c 3

testElectron:
name: Test Electron
runs-on: ubuntu-latest
Expand Down
16 changes: 10 additions & 6 deletions packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,15 @@ export default async function build(
PAGES_MANIFEST
)

// Sharp is optional.
let sharpPath: string | null = null
try {
sharpPath = path.relative(
dir,
path.join(path.dirname(require.resolve('sharp')), '**/*')
)
} catch (e) {}

const requiredServerFiles = traceFn(
tracer.startSpan('generate-required-server-files'),
() => ({
Expand All @@ -420,12 +429,7 @@ export default async function build(
]
.filter(nonNullable)
.map((file) => path.join(config.distDir, file)),
ignore: [
path.relative(
dir,
path.join(path.dirname(require.resolve('sharp')), '**/*')
),
],
ignore: [sharpPath].filter(nonNullable),
})
)

Expand Down