Skip to content
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

Don't fail build when optional dependency sharp is missing #20738

Closed
wants to merge 2 commits into from

Conversation

jorrit
Copy link
Contributor

@jorrit jorrit commented Jan 4, 2021

Fixes #20456

@ijjk
Copy link
Member

ijjk commented Jan 4, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 10.1s 10s -145ms
nodeModulesSize 80.6 MB 80.6 MB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
/ failed reqs 0 0
/ total time (seconds) 1.991 1.978 -0.01
/ avg req/sec 1255.7 1263.72 +8.02
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.224 1.244 ⚠️ +0.02
/error-in-render avg req/sec 2042.29 2010.22 ⚠️ -32.07
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..396f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39 kB 39 kB
main-a9a6f0d..a96d.js gzip 6.59 kB 6.59 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.3 kB 59.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-705099c..c35d.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary jorrit/next.js sharpoptional Change
index.html gzip 615 B 615 B
link.html gzip 621 B 621 B
withRouter.html gzip 607 B 607 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 11.9s 11.7s -226ms
nodeModulesSize 80.6 MB 80.6 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..396f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39 kB 39 kB
main-a9a6f0d..a96d.js gzip 6.59 kB 6.59 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.3 kB 59.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-705099c..c35d.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles
vercel/next.js canary jorrit/next.js sharpoptional Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.17 MB 5.17 MB
Commit: 270e2d0

@ijjk
Copy link
Member

ijjk commented Jan 4, 2021

Failing test suites

Commit: 270e2d0

test/integration/amphtml-fragment-style/test/index.test.js

  • AMP Fragment Styles > adds styles from fragment in AMP mode correctly
Expand output

● AMP Fragment Styles › adds styles from fragment in AMP mode correctly

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● Test suite failed to run

TypeError: Cannot read property '__app' of undefined

  316 | 
  317 | export async function stopApp(server) {
> 318 |   if (server.__app) {
      |              ^
  319 |     await server.__app.close()
  320 |   }
  321 |   await promiseCall(server, 'close')

  at stopApp (lib/next-test-utils.js:318:14)
  at integration/amphtml-fragment-style/test/index.test.js:32:18

test/integration/absolute-assetprefix/test/index.test.js

  • absolute assetPrefix with path prefix > should not fetch static data from a CDN
  • absolute assetPrefix with path prefix > should fetch from cache correctly
  • absolute assetPrefix with path prefix > should work with getStaticPaths prerendered
  • absolute assetPrefix with path prefix > should work with getStaticPaths fallback
  • absolute assetPrefix with path prefix > should work with getServerSideProps
Expand output

● absolute assetPrefix with path prefix › should not fetch static data from a CDN

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● absolute assetPrefix with path prefix › should fetch from cache correctly

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● absolute assetPrefix with path prefix › should work with getStaticPaths prerendered

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● absolute assetPrefix with path prefix › should work with getStaticPaths fallback

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● absolute assetPrefix with path prefix › should work with getServerSideProps

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/absolute-assetprefix/test/index.test.js:65:18

test/integration/amphtml-custom-optimizer/test/index.test.js

  • AMP Custom Optimizer > should build and start for static page
  • AMP Custom Optimizer > should build and start for dynamic page
Expand output

● AMP Custom Optimizer › should build and start for static page

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● AMP Custom Optimizer › should build and start for dynamic page

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

test/integration/app-document-style-fragment/test/index.test.js

  • Custom Document Fragment Styles > correctly adds styles from fragment styles key
Expand output

● Custom Document Fragment Styles › correctly adds styles from fragment styles key

command failed with code 1

  138 |         code !== 0
  139 |       ) {
> 140 |         return reject(new Error(`command failed with code ${code}`))
      |                       ^
  141 |       }
  142 | 
  143 |       resolve({

  at ChildProcess.<anonymous> (lib/next-test-utils.js:140:23)

● Test suite failed to run

TypeError: Cannot read property '__app' of undefined

  316 | 
  317 | export async function stopApp(server) {
> 318 |   if (server.__app) {
      |              ^
  319 |     await server.__app.close()
  320 |   }
  321 |   await promiseCall(server, 'close')

  at stopApp (lib/next-test-utils.js:318:14)
  at integration/app-document-style-fragment/test/index.test.js:31:18

test/integration/404-page-app/test/index.test.js

  • 404 Page Support with _app > production mode > should build successfully
  • 404 Page Support with _app > production mode > should not output static 404 if _app has getInitialProps
  • 404 Page Support with _app > production mode > should still use 404 page
Expand output

● 404 Page Support with _app › production mode › should build successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  32 |       })
  33 | 
> 34 |       expect(code).toBe(0)
     |                    ^
  35 |       expect(stderr).not.toMatch(gip404Err)
  36 |       expect(stdout).not.toMatch(gip404Err)
  37 | 

  at Object.<anonymous> (integration/404-page-app/test/index.test.js:34:20)

● 404 Page Support with _app › production mode › should not output static 404 if _app has getInitialProps

InvalidArgumentError: invalid argument
  (Session info: headless chrome=87.0.4280.88)

  177 |   console.log(`\n> Loading browser with ${url}\n`)
  178 | 
> 179 |   await browser.get(url)
      |   ^
  180 |   console.log(`\n> Loaded browser with ${url}\n`)
  181 | 
  182 |   // Wait for application to hydrate

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:565:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:491:26)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:700:17)
  at _default (lib/next-webdriver.js:179:3)
  at Object.<anonymous> (integration/404-page-app/test/index.test.js:43:23)

● 404 Page Support with _app › production mode › should still use 404 page

FetchError: request to http://localhost/:undefined/abc failed, reason: connect ECONNREFUSED 127.0.0.1:80

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1461:11)

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/404-page-app/test/index.test.js:26:20

test/integration/css-modules/test/index.test.js

  • 3rd Party CSS Module Support > should have compiled successfully
  • 3rd Party CSS Module Support > should've emitted a single CSS file
  • 3rd Party CSS Module Support > should've injected the CSS on server render
  • Basic CSS Module Support > should have compiled successfully
  • Basic CSS Module Support > should've emitted a single CSS file
  • Basic CSS Module Support > should've injected the CSS on server render
  • CSS Module Composes Usage (Basic) > should have compiled successfully
  • CSS Module Composes Usage (Basic) > should've emitted a single CSS file
  • CSS Module Composes Usage (External) > should have compiled successfully
  • CSS Module Composes Usage (External) > should've emitted a single CSS file
  • Catch-all Route CSS Module Usage > should have compiled successfully
  • Catch-all Route CSS Module Usage > should apply styles correctly
  • Catch-all Route CSS Module Usage > should've emitted a single CSS file
  • Dynamic Route CSS Module Usage > should have compiled successfully
  • Dynamic Route CSS Module Usage > should apply styles correctly
  • Dynamic Route CSS Module Usage > should've emitted a single CSS file
  • Has CSS Module in computed styles in Production > should have compiled successfully
  • Has CSS Module in computed styles in Production > should have CSS for page
  • Invalid CSS Module Usage in node_modules > should fail to build
  • Invalid Global CSS Module Usage in node_modules > should fail to build
  • Valid CSS Module Usage from within node_modules > should have compiled successfully
  • Valid CSS Module Usage from within node_modules > should've prerendered with relevant data
  • Valid CSS Module Usage from within node_modules > should've emitted a single CSS file
  • Valid Nested CSS Module Usage from within node_modules > should have compiled successfully
  • Valid Nested CSS Module Usage from within node_modules > should've prerendered with relevant data
  • Valid Nested CSS Module Usage from within node_modules > should've emitted a single CSS file
Expand output

● Basic CSS Module Support › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  40 | 
  41 |   it('should have compiled successfully', () => {
> 42 |     expect(code).toBe(0)
     |                  ^
  43 |     expect(stdout).toMatch(/Compiled successfully/)
  44 |     expect(stdout).toContain('.css')
  45 |   })

  at Object.<anonymous> (integration/css-modules/test/index.test.js:42:18)

● Basic CSS Module Support › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/basic-module/.next/static/css'

● Basic CSS Module Support › should've injected the CSS on server render

FetchError: request to http://localhost:33651/ failed, reason: connect ECONNREFUSED 127.0.0.1:33651

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1461:11)

● 3rd Party CSS Module Support › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

   97 | 
   98 |   it('should have compiled successfully', () => {
>  99 |     expect(code).toBe(0)
      |                  ^
  100 |     expect(stdout).toMatch(/Compiled successfully/)
  101 |   })
  102 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:99:18)

● 3rd Party CSS Module Support › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/3rd-party-module/.next/static/css'

● 3rd Party CSS Module Support › should've injected the CSS on server render

FetchError: request to http://localhost:39323/ failed, reason: connect ECONNREFUSED 127.0.0.1:39323

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1461:11)

● Has CSS Module in computed styles in Production › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  177 | 
  178 |   it('should have compiled successfully', () => {
> 179 |     expect(code).toBe(0)
      |                  ^
  180 |     expect(stdout).toMatch(/Compiled successfully/)
  181 |   })
  182 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:179:18)

● Has CSS Module in computed styles in Production › should have CSS for page

WebDriverError: unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: headless chrome=87.0.4280.88)

  177 |   console.log(`\n> Loading browser with ${url}\n`)
  178 | 
> 179 |   await browser.get(url)
      |   ^
  180 |   console.log(`\n> Loaded browser with ${url}\n`)
  181 | 
  182 |   // Wait for application to hydrate

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:565:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:491:26)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:700:17)
  at _default (lib/next-webdriver.js:179:3)
  at Object.<anonymous> (integration/css-modules/test/index.test.js:184:21)

● Invalid CSS Module Usage in node_modules › should fail to build

expect(received).toContain(expected) // indexOf

Expected substring: "Failed to compile"
Received string:    "
> Build error occurred
Error: Cannot find module 'sharp'
Require stack:
- /home/runner/work/next.js/next.js/packages/next/dist/build/index.js
- /home/runner/work/next.js/next.js/packages/next/dist/cli/next-build.js
- /home/runner/work/next.js/next.js/packages/next/dist/bin/next

   9 | });return{...r,...(type==='redirect'?{statusCode:(0,_loadCustomRoutes.getRedirectStatus)(r),permanent:undefined}:{}),regex:(0,_loadCustomRoutes.normalizeRouteRegex)(routeRegex.source)};};const routesManifestPath=_path.default.join(distDir,_constants2.ROUTES_MANIFEST);const routesManifest={version:3,pages404:true,basePath:config.basePath,redirects:redirects.map(r=>buildCustomRoute(r,'redirect')),rewrites:rewrites.map(r=>buildCustomRoute(r,'rewrite')),headers:headers.map(r=>buildCustomRoute(r,'header')),dynamicRoutes:(0,_utils.getSortedRoutes)(pageKeys).filter(_utils.isDynamicRoute).map(page=>{const routeRegex=(0,_utils.getRouteRegex)(page);return{page,regex:(0,_loadCustomRoutes.normalizeRouteRegex)(routeRegex.re.source),routeKeys:routeRegex.routeKeys,namedRegex:routeRegex.namedRegex};}),dataRoutes:[],i18n:config.i18n||undefined};await _fs.promises.mkdir(distDir,{recursive:true});// We need to write the manifest with rewrites before build
  10 | // so serverless can import the manifest
> 11 | await _fs.promises.writeFile(routesManifestPath,JSON.stringify(routesManifest),'utf8');const manifestPath=_path.default.join(distDir,isLikeServerless?_constants2.SERVERLESS_DIRECTORY:_constants2.SERVER_DIRECTORY,_constants2.PAGES_MANIFEST);const requiredServerFiles={version:1,config:{...config,compress:false,configFile:undefined},files:[_constants2.ROUTES_MANIFEST,_path.default.relative(distDir,manifestPath),_constants2.BUILD_MANIFEST,_constants2.PRERENDER_MANIFEST,_constants2.REACT_LOADABLE_MANIFEST,config.experimental.optimizeFonts?_path.default.join(isLikeServerless?_constants2.SERVERLESS_DIRECTORY:_constants2.SERVER_DIRECTORY,_constants2.FONT_MANIFEST):null,_constants2.BUILD_ID_FILE].filter(_nonNullable.nonNullable).map(file=>_path.default.join(config.distDir,file)),ignore:[_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('sharp')),'**/*'))]};const configs=await Promise.all([(0,_webpackConfig.default)(dir,{tracer:chromeProfiler,buildId,reactProductionProfiling,isServer:false,config,target,pagesDir,entrypoints:entrypoints.client,rewrites}),(0,_webpackConfig.default)(dir,{tracer:chromeProfiler,buildId,reactProductionProfiling,isServer:true,config,target,pagesDir,entrypoints:entrypoints.server,rewrites})]);const clientConfig=configs[0];if(clientConfig.optimization&&(clientConfig.optimization.minimize!==true||clientConfig.optimization.minimizer&&clientConfig.optimization.minimizer.length===0)){Log.warn(`Production code optimization has been disabled in your project. Read more: https://err.sh/vercel/next.js/minification-disabled`);}const webpackBuildStart=process.hrtime();let result={warnings:[],errors:[]};// TODO: why do we need this?? https://github.com/vercel/next.js/issues/8253
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^
  12 | if(isLikeServerless){const clientResult=await(0,_compiler.runCompiler)(clientConfig);// Fail build if clientResult contains errors
  13 | if(clientResult.errors.length>0){result={warnings:[...clientResult.warnings],errors:[...clientResult.errors]};}else{const serverResult=await(0,_compiler.runCompiler)(configs[1]);result={warnings:[...clientResult.warnings,...serverResult.warnings],errors:[...clientResult.errors,...serverResult.errors]};}}else{result=await(0,_compiler.runCompiler)(configs);}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_formatWebpackMessages.default)(result);if(result.errors.length>0){// Only keep the first error. Others are often indicative
  14 | // of the same problem, but confuse the reader with noise.

  at ../packages/next/dist/build/index.js:11:866
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534 {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      '/home/runner/work/next.js/next.js/packages/next/dist/build/index.js',
      '/home/runner/work/next.js/next.js/packages/next/dist/cli/next-build.js',
      '/home/runner/work/next.js/next.js/packages/next/dist/bin/next'
    ]
  }
  "
  at Object.<anonymous> (integration/css-modules/test/index.test.js:251:20)

● Invalid Global CSS Module Usage in node_modules › should fail to build

expect(received).toContain(expected) // indexOf

Expected substring: "Failed to compile"
Received string:    "
> Build error occurred
Error: Cannot find module 'sharp'
Require stack:
- /home/runner/work/next.js/next.js/packages/next/dist/build/index.js
- /home/runner/work/next.js/next.js/packages/next/dist/cli/next-build.js
- /home/runner/work/next.js/next.js/packages/next/dist/bin/next

   9 | });return{...r,...(type==='redirect'?{statusCode:(0,_loadCustomRoutes.getRedirectStatus)(r),permanent:undefined}:{}),regex:(0,_loadCustomRoutes.normalizeRouteRegex)(routeRegex.source)};};const routesManifestPath=_path.default.join(distDir,_constants2.ROUTES_MANIFEST);const routesManifest={version:3,pages404:true,basePath:config.basePath,redirects:redirects.map(r=>buildCustomRoute(r,'redirect')),rewrites:rewrites.map(r=>buildCustomRoute(r,'rewrite')),headers:headers.map(r=>buildCustomRoute(r,'header')),dynamicRoutes:(0,_utils.getSortedRoutes)(pageKeys).filter(_utils.isDynamicRoute).map(page=>{const routeRegex=(0,_utils.getRouteRegex)(page);return{page,regex:(0,_loadCustomRoutes.normalizeRouteRegex)(routeRegex.re.source),routeKeys:routeRegex.routeKeys,namedRegex:routeRegex.namedRegex};}),dataRoutes:[],i18n:config.i18n||undefined};await _fs.promises.mkdir(distDir,{recursive:true});// We need to write the manifest with rewrites before build
  10 | // so serverless can import the manifest
> 11 | await _fs.promises.writeFile(routesManifestPath,JSON.stringify(routesManifest),'utf8');const manifestPath=_path.default.join(distDir,isLikeServerless?_constants2.SERVERLESS_DIRECTORY:_constants2.SERVER_DIRECTORY,_constants2.PAGES_MANIFEST);const requiredServerFiles={version:1,config:{...config,compress:false,configFile:undefined},files:[_constants2.ROUTES_MANIFEST,_path.default.relative(distDir,manifestPath),_constants2.BUILD_MANIFEST,_constants2.PRERENDER_MANIFEST,_constants2.REACT_LOADABLE_MANIFEST,config.experimental.optimizeFonts?_path.default.join(isLikeServerless?_constants2.SERVERLESS_DIRECTORY:_constants2.SERVER_DIRECTORY,_constants2.FONT_MANIFEST):null,_constants2.BUILD_ID_FILE].filter(_nonNullable.nonNullable).map(file=>_path.default.join(config.distDir,file)),ignore:[_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('sharp')),'**/*'))]};const configs=await Promise.all([(0,_webpackConfig.default)(dir,{tracer:chromeProfiler,buildId,reactProductionProfiling,isServer:false,config,target,pagesDir,entrypoints:entrypoints.client,rewrites}),(0,_webpackConfig.default)(dir,{tracer:chromeProfiler,buildId,reactProductionProfiling,isServer:true,config,target,pagesDir,entrypoints:entrypoints.server,rewrites})]);const clientConfig=configs[0];if(clientConfig.optimization&&(clientConfig.optimization.minimize!==true||clientConfig.optimization.minimizer&&clientConfig.optimization.minimizer.length===0)){Log.warn(`Production code optimization has been disabled in your project. Read more: https://err.sh/vercel/next.js/minification-disabled`);}const webpackBuildStart=process.hrtime();let result={warnings:[],errors:[]};// TODO: why do we need this?? https://github.com/vercel/next.js/issues/8253
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^
  12 | if(isLikeServerless){const clientResult=await(0,_compiler.runCompiler)(clientConfig);// Fail build if clientResult contains errors
  13 | if(clientResult.errors.length>0){result={warnings:[...clientResult.warnings],errors:[...clientResult.errors]};}else{const serverResult=await(0,_compiler.runCompiler)(configs[1]);result={warnings:[...clientResult.warnings,...serverResult.warnings],errors:[...clientResult.errors,...serverResult.errors]};}}else{result=await(0,_compiler.runCompiler)(configs);}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_formatWebpackMessages.default)(result);if(result.errors.length>0){// Only keep the first error. Others are often indicative
  14 | // of the same problem, but confuse the reader with noise.

  at ../packages/next/dist/build/index.js:11:866
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534 {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      '/home/runner/work/next.js/next.js/packages/next/dist/build/index.js',
      '/home/runner/work/next.js/next.js/packages/next/dist/cli/next-build.js',
      '/home/runner/work/next.js/next.js/packages/next/dist/bin/next'
    ]
  }
  "
  at Object.<anonymous> (integration/css-modules/test/index.test.js:272:20)

● Valid CSS Module Usage from within node_modules › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  303 | 
  304 |   it('should have compiled successfully', () => {
> 305 |     expect(code).toBe(0)
      |                  ^
  306 |     expect(stdout).toMatch(/Compiled successfully/)
  307 |   })
  308 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:305:18)

● Valid CSS Module Usage from within node_modules › should've prerendered with relevant data

FetchError: request to http://localhost:46831/ failed, reason: connect ECONNREFUSED 127.0.0.1:46831

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1461:11)

● Valid CSS Module Usage from within node_modules › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/nm-module/.next/static/css'

● Valid Nested CSS Module Usage from within node_modules › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  356 | 
  357 |   it('should have compiled successfully', () => {
> 358 |     expect(code).toBe(0)
      |                  ^
  359 |     expect(stdout).toMatch(/Compiled successfully/)
  360 |   })
  361 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:358:18)

● Valid Nested CSS Module Usage from within node_modules › should've prerendered with relevant data

FetchError: request to http://localhost:46043/ failed, reason: connect ECONNREFUSED 127.0.0.1:46043

  at ClientRequest.<anonymous> (../node_modules/node-fetch/lib/index.js:1461:11)

● Valid Nested CSS Module Usage from within node_modules › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/nm-module-nested/.next/static/css'

● CSS Module Composes Usage (Basic) › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  399 | 
  400 |   it('should have compiled successfully', () => {
> 401 |     expect(code).toBe(0)
      |                  ^
  402 |     expect(stdout).toMatch(/Compiled successfully/)
  403 |   })
  404 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:401:18)

● CSS Module Composes Usage (Basic) › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/composes-basic/.next/static/css'

● CSS Module Composes Usage (External) › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  432 | 
  433 |   it('should have compiled successfully', () => {
> 434 |     expect(code).toBe(0)
      |                  ^
  435 |     expect(stdout).toMatch(/Compiled successfully/)
  436 |   })
  437 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:434:18)

● CSS Module Composes Usage (External) › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/composes-external/.next/static/css'

● Dynamic Route CSS Module Usage › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  470 | 
  471 |   it('should have compiled successfully', () => {
> 472 |     expect(code).toBe(0)
      |                  ^
  473 |     expect(stdout).toMatch(/Compiled successfully/)
  474 |   })
  475 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:472:18)

● Dynamic Route CSS Module Usage › should apply styles correctly

WebDriverError: unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: headless chrome=87.0.4280.88)

  177 |   console.log(`\n> Loading browser with ${url}\n`)
  178 | 
> 179 |   await browser.get(url)
      |   ^
  180 |   console.log(`\n> Loaded browser with ${url}\n`)
  181 | 
  182 |   // Wait for application to hydrate

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:565:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:491:26)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:700:17)
  at _default (lib/next-webdriver.js:179:3)
  at Object.<anonymous> (integration/css-modules/test/index.test.js:477:21)

● Dynamic Route CSS Module Usage › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/dynamic-route-module/.next/static/css'

● Catch-all Route CSS Module Usage › should have compiled successfully

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 1

  518 | 
  519 |   it('should have compiled successfully', () => {
> 520 |     expect(code).toBe(0)
      |                  ^
  521 |     expect(stdout).toMatch(/Compiled successfully/)
  522 |   })
  523 | 

  at Object.<anonymous> (integration/css-modules/test/index.test.js:520:18)

● Catch-all Route CSS Module Usage › should apply styles correctly

WebDriverError: unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: headless chrome=87.0.4280.88)

  177 |   console.log(`\n> Loading browser with ${url}\n`)
  178 | 
> 179 |   await browser.get(url)
      |   ^
  180 |   console.log(`\n> Loaded browser with ${url}\n`)
  181 | 
  182 |   // Wait for application to hydrate

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:565:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:491:26)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:700:17)
  at _default (lib/next-webdriver.js:179:3)
  at Object.<anonymous> (integration/css-modules/test/index.test.js:525:21)

● Catch-all Route CSS Module Usage › should've emitted a single CSS file

ENOENT: no such file or directory, scandir '/home/runner/work/next.js/next.js/test/integration/css-fixtures/catch-all-module/.next/static/css'

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/css-modules/test/index.test.js:38:11

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/css-modules/test/index.test.js:95:11

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/css-modules/test/index.test.js:175:11

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/css-modules/test/index.test.js:301:11

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/css-modules/test/index.test.js:354:11

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/css-modules/test/index.test.js:469:18

● Test suite failed to run

TypeError: Cannot read property 'pid' of undefined

  282 | export async function killApp(instance) {
  283 |   await new Promise((resolve, reject) => {
> 284 |     treeKill(instance.pid, (err) => {
      |                       ^
  285 |       if (err) {
  286 |         if (
  287 |           process.platform === 'win32' &&

  at lib/next-test-utils.js:284:23
  at killApp (lib/next-test-utils.js:283:9)
  at integration/css-modules/test/index.test.js:517:18

@ijjk ijjk added the type: next label Jan 4, 2021
@jorrit jorrit changed the title sharp no longer optional since 10.0.4-canary.7 Don't fail build when optional dependency sharp is missing Jan 4, 2021
@ijjk
Copy link
Member

ijjk commented Jan 4, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 10.6s 10.5s -124ms
nodeModulesSize 80.6 MB 80.6 MB ⚠️ +379 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
/ failed reqs 0 0
/ total time (seconds) 2.068 2.12 ⚠️ +0.05
/ avg req/sec 1208.63 1179.13 ⚠️ -29.5
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.293 1.307 ⚠️ +0.01
/error-in-render avg req/sec 1933.08 1912.85 ⚠️ -20.23
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..396f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39 kB 39 kB
main-a9a6f0d..a96d.js gzip 6.59 kB 6.59 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.3 kB 59.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-705099c..c35d.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary jorrit/next.js sharpoptional Change
index.html gzip 615 B 615 B
link.html gzip 621 B 621 B
withRouter.html gzip 607 B 607 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 12.7s 12.7s ⚠️ +88ms
nodeModulesSize 80.6 MB 80.6 MB ⚠️ +379 B
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..396f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39 kB 39 kB
main-a9a6f0d..a96d.js gzip 6.59 kB 6.59 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.3 kB 59.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-705099c..c35d.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles
vercel/next.js canary jorrit/next.js sharpoptional Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.17 MB 5.17 MB
Commit: f6ce0b4

@ijjk
Copy link
Member

ijjk commented Jan 4, 2021

Failing test suites

Commit: f6ce0b4

test/integration/image-optimizer/test/index.test.js

Expand output

● Test suite failed to run

Cannot find module 'sharp' from 'index.test.js'

  13 |   waitFor,
  14 | } from 'next-test-utils'
> 15 | import sharp from 'sharp'
     | ^
  16 | 
  17 | jest.setTimeout(1000 * 60 * 2)
  18 | 

  at Resolver.resolveModule (../node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (integration/image-optimizer/test/index.test.js:15:1)

@jorrit
Copy link
Contributor Author

jorrit commented Jan 4, 2021

I have added a separate test job that excludes sharp but I can imagine that this increases the CI time too much to be acceptable.

giriloou
giriloou previously approved these changes Jan 4, 2021
@ijjk
Copy link
Member

ijjk commented Jan 7, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 9.3s 9.5s ⚠️ +171ms
nodeModulesSize 80.8 MB 80.8 MB ⚠️ +379 B
Page Load Tests Overall increase ✓
vercel/next.js canary jorrit/next.js sharpoptional Change
/ failed reqs 0 0
/ total time (seconds) 1.836 1.849 ⚠️ +0.01
/ avg req/sec 1361.34 1352.16 ⚠️ -9.18
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.212 1.158 -0.05
/error-in-render avg req/sec 2063.32 2159.31 +95.99
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary jorrit/next.js sharpoptional Change
index.html gzip 614 B 614 B
link.html gzip 619 B 619 B
withRouter.html gzip 606 B 606 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 11.3s 11.2s -105ms
nodeModulesSize 80.8 MB 80.8 MB ⚠️ +379 B
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles
vercel/next.js canary jorrit/next.js sharpoptional Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.18 MB 5.18 MB
Commit: cfd7d81

@ijjk
Copy link
Member

ijjk commented Jan 7, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 10.8s 10.7s -139ms
nodeModulesSize 80.8 MB 80.8 MB ⚠️ +379 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
/ failed reqs 0 0
/ total time (seconds) 2.169 2.171 0
/ avg req/sec 1152.44 1151.73 ⚠️ -0.71
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.584 1.639 ⚠️ +0.05
/error-in-render avg req/sec 1577.95 1525.11 ⚠️ -52.84
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary jorrit/next.js sharpoptional Change
index.html gzip 614 B 614 B
link.html gzip 619 B 619 B
withRouter.html gzip 606 B 606 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 12.5s 12.6s ⚠️ +84ms
nodeModulesSize 80.8 MB 80.8 MB ⚠️ +379 B
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles
vercel/next.js canary jorrit/next.js sharpoptional Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.18 MB 5.18 MB
Commit: b6a758a

@jorrit jorrit marked this pull request as ready for review February 3, 2021 08:33
@jorrit
Copy link
Contributor Author

jorrit commented Feb 3, 2021

I had accidently left this PR in draft state.

@ijjk
Copy link
Member

ijjk commented Feb 3, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 9.8s 9.9s ⚠️ +83ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +369 B
Page Load Tests Overall increase ✓
vercel/next.js canary jorrit/next.js sharpoptional Change
/ failed reqs 0 0
/ total time (seconds) 1.955 1.947 -0.01
/ avg req/sec 1278.85 1284.3 +5.45
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.215 1.205 -0.01
/error-in-render avg req/sec 2058.18 2075.23 +17.05
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Rendered Page Sizes
vercel/next.js canary jorrit/next.js sharpoptional Change
index.html gzip 615 B 615 B
link.html gzip 621 B 621 B
withRouter.html gzip 609 B 609 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 11.7s 11.6s -156ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +369 B
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
677f882d2ed8..49c4.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.63 kB 6.63 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.5 kB 59.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
hooks-c71ae4..70cd.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-7faf09b..eba4.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Serverless bundles
vercel/next.js canary jorrit/next.js sharpoptional Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.19 MB 5.19 MB

Webpack 5 Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
buildDuration 11.9s 11.8s -115ms
nodeModulesSize 75.1 MB 75.1 MB ⚠️ +369 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary jorrit/next.js sharpoptional Change
/ failed reqs 0 0
/ total time (seconds) 1.907 1.967 ⚠️ +0.06
/ avg req/sec 1311.23 1270.8 ⚠️ -40.43
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.191 1.205 ⚠️ +0.01
/error-in-render avg req/sec 2099.35 2075.29 ⚠️ -24.06
Client Bundles (main, webpack, commons)
vercel/next.js canary jorrit/next.js sharpoptional Change
597-6c246419..806f.js gzip 13 kB 13 kB
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 6.58 kB 6.58 kB
webpack-HASH.js gzip 954 B 954 B
Overall change 59.9 kB 59.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary jorrit/next.js sharpoptional Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary jorrit/next.js sharpoptional Change
_app-6e0a903..b885.js gzip 1.26 kB 1.26 kB
_error-7a100..a392.js gzip 3.38 kB 3.38 kB
hooks-f7e199..11b9.js gzip 904 B 904 B
index-3dc22c..ffbb.js gzip 232 B 232 B
link-c010d28..b60a.js gzip 1.63 kB 1.63 kB
routerDirect..323a.js gzip 308 B 308 B
withRouter-a..2ef8.js gzip 304 B 304 B
Overall change 8.02 kB 8.02 kB
Client Build Manifests
vercel/next.js canary jorrit/next.js sharpoptional Change
_buildManifest.js gzip 299 B 299 B
Overall change 299 B 299 B
Rendered Page Sizes
vercel/next.js canary jorrit/next.js sharpoptional Change
index.html gzip 586 B 586 B
link.html gzip 593 B 593 B
withRouter.html gzip 579 B 579 B
Overall change 1.76 kB 1.76 kB

Diffs

Diff for index.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "ISeX8XvBagrzAZPxbfJke",
+        "buildId": "HTtWLQ4AQ7gTnnUnJ4dqs",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/ISeX8XvBagrzAZPxbfJke/_buildManifest.js"
+      src="/_next/static/HTtWLQ4AQ7gTnnUnJ4dqs/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/ISeX8XvBagrzAZPxbfJke/_ssgManifest.js"
+      src="/_next/static/HTtWLQ4AQ7gTnnUnJ4dqs/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "ISeX8XvBagrzAZPxbfJke",
+        "buildId": "HTtWLQ4AQ7gTnnUnJ4dqs",
         "isFallback": false,
         "gip": true
       }
@@ -82,11 +82,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/ISeX8XvBagrzAZPxbfJke/_buildManifest.js"
+      src="/_next/static/HTtWLQ4AQ7gTnnUnJ4dqs/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/ISeX8XvBagrzAZPxbfJke/_ssgManifest.js"
+      src="/_next/static/HTtWLQ4AQ7gTnnUnJ4dqs/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "ISeX8XvBagrzAZPxbfJke",
+        "buildId": "HTtWLQ4AQ7gTnnUnJ4dqs",
         "isFallback": false,
         "gip": true
       }
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/ISeX8XvBagrzAZPxbfJke/_buildManifest.js"
+      src="/_next/static/HTtWLQ4AQ7gTnnUnJ4dqs/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/ISeX8XvBagrzAZPxbfJke/_ssgManifest.js"
+      src="/_next/static/HTtWLQ4AQ7gTnnUnJ4dqs/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: 6e1af65

@kodiakhq kodiakhq bot closed this in #22253 Feb 18, 2021
kodiakhq bot pushed a commit that referenced this pull request Feb 18, 2021
This pull request removes the native `sharp` dependency (which doesn't work on some Linux variants, nor **M1 Mac**) and replaces it with a wasm equivalent.

It also reduces Next.js' installed size by 27.3 MB.

The code is adapted from the [Squoosh CLI](https://github.com/GoogleChromeLabs/squoosh).

This PR still supports:

- Rotation normalization
- Resizing
- PNG
- JPEG
- Webp

However, it (temporarily) removes support for:
- Resizing Gifs
- Resizing Tiff

(these formats still get served and rendered correctly by the image component)

---

Fixes #20456
Closes #20738
Closes #21762
@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sharp no longer optional since 10.0.4-canary.7
3 participants