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

Updated the Error message describing the alternative and added styles… #14652

Merged
merged 10 commits into from
Jul 25, 2021

Conversation

brijendravarma
Copy link
Contributor

The error message indicates better alternatives and added styles.css sample snippet for good visibility.

Global_error_msg
CSS-Global

@ijjk

This comment has been minimized.

errors/css-global.md Outdated Show resolved Hide resolved
timneutkens
timneutkens previously approved these changes Jan 23, 2021
@ijjk

This comment has been minimized.

@ijjk
Copy link
Member

ijjk commented Jan 23, 2021

Failing test suites

Commit: b97e1e2

test/integration/scss/test/index.test.js

  • SCSS Support > Invalid Global CSS > should fail to build
  • SCSS Support > Invalid Global CSS with Custom App > should fail to build
  • SCSS Support > Valid and Invalid Global CSS with Custom App > should fail to build
Expand output

● SCSS Support › Invalid Global CSS › should fail to build

expect(received).toMatch(expected)

Expected pattern: /Please move all global CSS imports.*?pages(\/|\\)_app/
Received string:  "Failed to compile.·
./styles/global.scss
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/scss/test/index.test.js:357:22)

● SCSS Support › Invalid Global CSS with Custom App › should fail to build

expect(received).toMatch(expected)

Expected pattern: /Please move all global CSS imports.*?pages(\/|\\)_app/
Received string:  "Failed to compile.·
./styles/global.scss
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/scss/test/index.test.js:378:22)

● SCSS Support › Valid and Invalid Global CSS with Custom App › should fail to build

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

Expected substring: "Please move all global CSS imports"
Received string:    "Failed to compile.·
./styles/global.scss
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/scss/test/index.test.js:399:22)

test/integration/css/test/index.test.js

  • CSS Support > Invalid Global CSS > should fail to build
  • CSS Support > Invalid Global CSS with Custom App > should fail to build
  • CSS Support > Valid and Invalid Global CSS with Custom App > should fail to build
Expand output

● CSS Support › Invalid Global CSS › should fail to build

expect(received).toMatch(expected)

Expected pattern: /Please move all global CSS imports.*?pages(\/|\\)_app/
Received string:  "Failed to compile.·
./styles/global.css
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/css/test/index.test.js:359:22)

● CSS Support › Invalid Global CSS with Custom App › should fail to build

expect(received).toMatch(expected)

Expected pattern: /Please move all global CSS imports.*?pages(\/|\\)_app/
Received string:  "Failed to compile.·
./styles/global.css
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/css/test/index.test.js:409:22)

● CSS Support › Valid and Invalid Global CSS with Custom App › should fail to build

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

Expected substring: "Please move all global CSS imports"
Received string:    "Failed to compile.·
./styles/global.css
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/css/test/index.test.js:430:22)

@ijjk
Copy link
Member

ijjk commented Jan 24, 2021

Failing test suites

Commit: d0fc093

test/integration/dist-dir/test/index.test.js

  • distDir > should handle null/undefined distDir
Expand output

● distDir › should handle null/undefined distDir

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

Expected: 0
Received: 88

  63 |     await fs.writeFile(nextConfig, origNextConfig)
  64 | 
> 65 |     expect(stderr.length).toBe(0)
     |                           ^
  66 |   })
  67 | })
  68 | 

  at Object.<anonymous> (integration/dist-dir/test/index.test.js:65:27)

test/integration/production-build-dir/test/index.test.js

  • Production Custom Build Directory > With basic usage > should render the page
Expand output

● Production Custom Build Directory › With basic usage › should render the page

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

Expected: ""
Received: "Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
"

  20 |         stderr: true,
  21 |       })
> 22 |       expect(result.stderr).toBe('')
     |                             ^
  23 | 
  24 |       const app = nextServer({
  25 |         dir: join(__dirname, '../build'),

  at Object.<anonymous> (integration/production-build-dir/test/index.test.js:22:29)

test/integration/scss/test/index.test.js

  • SCSS Support > Valid and Invalid Global CSS with Custom App > should fail to build
Expand output

● SCSS Support › Valid and Invalid Global CSS with Custom App › should fail to build

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

Expected substring: "Please move all global CSS imports"
Received string:    "Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Failed to compile.·
./styles/global.scss
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/scss/test/index.test.js:399:22)

test/integration/css/test/index.test.js

  • CSS Support > Valid and Invalid Global CSS with Custom App > should fail to build
Expand output

● CSS Support › Valid and Invalid Global CSS with Custom App › should fail to build

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

Expected substring: "Please move all global CSS imports"
Received string:    "Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Failed to compile.·
./styles/global.css
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/css/test/index.test.js:430:22)

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk
Copy link
Member

ijjk commented Jan 27, 2021

Failing test suites

Commit: 126c32e

test/integration/scss/test/index.test.js

  • SCSS Support > Valid and Invalid Global CSS with Custom App > should fail to build
Expand output

● SCSS Support › Valid and Invalid Global CSS with Custom App › should fail to build

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

Expected substring: "Please move all global CSS imports"
Received string:    "Failed to compile.·
./styles/global.scss
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/scss/test/index.test.js:399:22)

test/integration/css/test/index.test.js

  • CSS Support > Valid and Invalid Global CSS with Custom App > should fail to build
Expand output

● CSS Support › Valid and Invalid Global CSS with Custom App › should fail to build

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

Expected substring: "Please move all global CSS imports"
Received string:    "Failed to compile.·
./styles/global.css
Global CSS cannot be imported from files other than your Custom <App>. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to pages/_app.js. Or convert the import to Component-Level CSS (CSS Modules).
Read more: https://err.sh/next.js/css-global
Location: pages/index.js··
> Build error occurred
Error: > Build failed because of webpack 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,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('run-webpack-compiler'),()=>(0,_compiler.runCompiler)(configs));}const webpackBuildEnd=process.hrtime(webpackBuildStart);if(buildSpinner){buildSpinner.stopAndPersist();}result=(0,_tracer.traceFn)(_tracer.tracer.startSpan('format-webpack-messages'),()=>(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.
> 15 | if(result.errors.length>1){result.errors.length=1;}const error=result.errors.join('\n\n');console.error(_chalk.default.red('Failed to compile.\n'));if(error.indexOf('private-next-pages')>-1&&error.indexOf('does not contain a default export')>-1){const page_name_regex=/*#__PURE__*/_wrapRegExp(/'private\x2Dnext\x2Dpages\/((?:(?!')[\s\S])*)'/,{page_name:1});const parsed=page_name_regex.exec(error);const page_name=parsed&&parsed.groups&&parsed.groups.page_name;throw new Error(`webpack build failed: found page without a React Component as default export in pages/${page_name}\n\nSee https://err.sh/vercel/next.js/page-without-valid-component for more info.`);}console.error(error);console.error();if(error.indexOf('private-next-pages')>-1||error.indexOf('__next_polyfill__')>-1){throw new Error('> webpack config.resolve.alias was incorrectly overridden. https://err.sh/vercel/next.js/invalid-resolve-alias');}throw new Error('> Build failed because of webpack errors');}else{telemetry.record((0,_events.eventBuildCompleted)(pagePaths,{durationInSeconds:webpackBuildEnd[0]}));if(result.warnings.length>0){Log.warn('Compiled with warnings\n');console.warn(result.warnings.join('\n\n'));console.warn();}else{Log.info('Compiled successfully');}}const postCompileSpinner=(0,_spinner.default)({prefixText:`${Log.prefixes.info} Collecting page data`});const buildManifestPath=_path.default.join(distDir,_constants2.BUILD_MANIFEST);const ssgPages=new Set();const ssgStaticFallbackPages=new Set();const ssgBlockingFallbackPages=new Set();const staticPages=new Set();const invalidPages=new Set();const hybridAmpPages=new Set();const serverPropsPages=new Set();const additionalSsgPaths=new Map();const additionalSsgPathsEncoded=new Map();const pageInfos=new Map();const pagesManifest=JSON.parse(await _fs.promises.readFile(manifestPath,'utf8'));const buildManifest=JSON.parse(await _fs.promises.readFile(buildManifestPath,'utf8'));let customAppGetInitialProps;let namedExports;let isNextImageImported;const analysisBegin=process.hrtime();let hasSsrAmpPages=false;const staticCheckSpan=_tracer.tracer.startSpan('static-check');const{hasNonStaticErrorPage}=await(0,_tracer.traceAsyncFn)(staticCheckSpan,async()=>{process.env.NEXT_PHASE=_constants2.PHASE_PRODUCTION_BUILD;const staticCheckWorkers=new _jestWorker.default(staticCheckWorker,{numWorkers:config.experimental.cpus,enableWorkerThreads:config.experimental.workerThreads});staticCheckWorkers.getStdout().pipe(process.stdout);staticCheckWorkers.getStderr().pipe(process.stderr);const runtimeEnvConfig={publicRuntimeConfig:config.publicRuntimeConfig,serverRuntimeConfig:config.serverRuntimeConfig};const nonStaticErrorPage=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-static-error-page'),async()=>hasCustomErrorPage&&(await(0,_utils2.hasCustomGetInitialProps)((0,_require.getPagePath)('/_error',distDir,isLikeServerless),runtimeEnvConfig,false)));await Promise.all(pageKeys.map(async page=>{return(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('check-page',{attributes:{page}}),async()=>{const actualPage=(0,_normalizePagePath.normalizePagePath)(page);const[selfSize,allSize]=await(0,_utils2.getJsPageSizeInKb)(actualPage,distDir,buildManifest);let isSsg=false;let isStatic=false;let isHybridAmp=false;let ssgPageRoutes=null;const nonReservedPage=!page.match(/^\/(_app|_error|_document|api(\/|$))/);if(nonReservedPage){const serverBundle=(0,_require.getPagePath)(page,distDir,isLikeServerless);if(customAppGetInitialProps===undefined){customAppGetInitialProps=await(0,_utils2.hasCustomGetInitialProps)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig,true);namedExports=(0,_utils2.getNamedExports)(isLikeServerless?serverBundle:(0,_require.getPagePath)('/_app',distDir,isLikeServerless),runtimeEnvConfig);if(customAppGetInitialProps){console.warn(_chalk.default.bold.yellow(`Warning: `)+_chalk.default.yellow(`You have opted-out of Automatic Static Optimization due to \`getInitialProps\` in \`pages/_app\`. This does not opt-out pages with \`getStaticProps\``));console.warn('Read more: https://err.sh/next.js/opt-out-auto-static-optimization\n');}}try{let workerResult=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-page-static'),()=>{var _config$i18n,_config$i18n2;const spanContext={};_api.default.propagation.inject(_api.default.context.active(),spanContext);return staticCheckWorkers.isPageStatic(page,serverBundle,runtimeEnvConfig,(_config$i18n=config.i18n)==null?void 0:_config$i18n.locales,(_config$i18n2=config.i18n)==null?void 0:_config$i18n2.defaultLocale,spanContext);});if(workerResult.isStatic===false&&(workerResult.isHybridAmp||workerResult.isAmpOnly)){hasSsrAmpPages=true;}if(workerResult.isHybridAmp){isHybridAmp=true;hybridAmpPages.add(page);}if(workerResult.isNextImageImported){isNextImageImported=true;}if(workerResult.hasStaticProps){ssgPages.add(page);isSsg=true;if(workerResult.prerenderRoutes&&workerResult.encodedPrerenderRoutes){additionalSsgPaths.set(page,workerResult.prerenderRoutes);additionalSsgPathsEncoded.set(page,workerResult.encodedPrerenderRoutes);ssgPageRoutes=workerResult.prerenderRoutes;}if(workerResult.prerenderFallback==='blocking'){ssgBlockingFallbackPages.add(page);}else if(workerResult.prerenderFallback===true){ssgStaticFallbackPages.add(page);}}else if(workerResult.hasServerProps){serverPropsPages.add(page);}else if(workerResult.isStatic&&customAppGetInitialProps===false){staticPages.add(page);isStatic=true;}if(hasPages404&&page==='/404'){if(!workerResult.isStatic&&!workerResult.hasStaticProps){throw new Error(_constants.PAGES_404_GET_INITIAL_PROPS_ERROR);}// we need to ensure the 404 lambda is present since we use
     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
  16 | // it when _app has getInitialProps
  17 | if(customAppGetInitialProps&&!workerResult.hasStaticProps){staticPages.delete(page);}}}catch(err){if(err.message!=='INVALID_DEFAULT_EXPORT')throw err;invalidPages.add(page);}}pageInfos.set(page,{size:selfSize,totalSize:allSize,static:isStatic,isSsg,isHybridAmp,ssgPageRoutes,initialRevalidateSeconds:false});});}));staticCheckWorkers.end();return{hasNonStaticErrorPage:nonStaticErrorPage};});if(!hasSsrAmpPages){requiredServerFiles.ignore.push(_path.default.relative(dir,_path.default.join(_path.default.dirname(require.resolve('@ampproject/toolbox-optimizer')),'**/*')));}if(serverPropsPages.size>0||ssgPages.size>0){// We update the routes manifest after the build with the
  18 | // data routes since we can't determine these until after build

  at ../packages/next/dist/build/index.js:15:918
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:534
  "
  at Object.<anonymous> (integration/css/test/index.test.js:430:22)

Copy link
Member

@timneutkens timneutkens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix the tests?

@ijjk
Copy link
Member

ijjk commented Jul 25, 2021

Stats from current PR

Default Build (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
buildDuration 17.1s 16.9s -185ms
buildDurationCached 3.8s 3.6s -171ms
nodeModulesSize 49.5 MB 49.5 MB ⚠️ +154 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
/ failed reqs 0 0
/ total time (seconds) 2.709 2.862 ⚠️ +0.15
/ avg req/sec 922.77 873.52 ⚠️ -49.25
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.548 1.563 ⚠️ +0.01
/error-in-render avg req/sec 1614.62 1599.13 ⚠️ -15.49
Client Bundles (main, webpack, commons)
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
359.HASH.js gzip 2.96 kB 2.96 kB
745.HASH.js gzip 180 B 180 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 21 kB 21 kB
webpack-HASH.js gzip 1.53 kB 1.53 kB
Overall change 67.9 kB 67.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution 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 brijendravarma/next.js my-errorMsg-contribution Change
_app-HASH.js gzip 803 B 803 B
_error-HASH.js gzip 3.06 kB 3.06 kB
amp-HASH.js gzip 554 B 554 B
css-HASH.js gzip 329 B 329 B
dynamic-HASH.js gzip 2.52 kB 2.52 kB
head-HASH.js gzip 2.28 kB 2.28 kB
hooks-HASH.js gzip 903 B 903 B
image-HASH.js gzip 5.63 kB 5.63 kB
index-HASH.js gzip 261 B 261 B
link-HASH.js gzip 1.66 kB 1.66 kB
routerDirect..HASH.js gzip 319 B 319 B
script-HASH.js gzip 387 B 387 B
withRouter-HASH.js gzip 320 B 320 B
bb14e60e810b..30f.css gzip 125 B 125 B
Overall change 19.1 kB 19.1 kB
Client Build Manifests
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
_buildManifest.js gzip 489 B 489 B
Overall change 489 B 489 B
Rendered Page Sizes
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
index.html gzip 531 B 531 B
link.html gzip 542 B 542 B
withRouter.html gzip 525 B 525 B
Overall change 1.6 kB 1.6 kB

Webpack 4 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
buildDuration 13.1s 13.4s ⚠️ +273ms
buildDurationCached 5.1s 5.1s ⚠️ +59ms
nodeModulesSize 49.5 MB 49.5 MB ⚠️ +154 B
Page Load Tests Overall increase ✓
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
/ failed reqs 0 0
/ total time (seconds) 2.839 2.856 ⚠️ +0.02
/ avg req/sec 880.71 875.35 ⚠️ -5.36
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.553 1.492 -0.06
/error-in-render avg req/sec 1609.28 1675.07 +65.79
Client Bundles (main, webpack, commons)
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
17.HASH.js gzip 2.98 kB 2.98 kB
18.HASH.js gzip 185 B 185 B
677f882d2ed8..HASH.js gzip 13.8 kB 13.8 kB
framework.HASH.js gzip 41.9 kB 41.9 kB
main-HASH.js gzip 8.4 kB 8.4 kB
webpack-HASH.js gzip 1.22 kB 1.22 kB
Overall change 68.5 kB 68.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution 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 brijendravarma/next.js my-errorMsg-contribution Change
_app-HASH.js gzip 791 B 791 B
_error-HASH.js gzip 3.76 kB 3.76 kB
amp-HASH.js gzip 552 B 552 B
css-HASH.js gzip 333 B 333 B
dynamic-HASH.js gzip 2.71 kB 2.71 kB
head-HASH.js gzip 2.97 kB 2.97 kB
hooks-HASH.js gzip 911 B 911 B
index-HASH.js gzip 231 B 231 B
link-HASH.js gzip 1.64 kB 1.64 kB
routerDirect..HASH.js gzip 298 B 298 B
script-HASH.js gzip 3.02 kB 3.02 kB
withRouter-HASH.js gzip 294 B 294 B
e025d2764813..52f.css gzip 125 B 125 B
Overall change 17.6 kB 17.6 kB
Client Build Manifests
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
_buildManifest.js gzip 500 B 500 B
Overall change 500 B 500 B
Rendered Page Sizes
vercel/next.js canary brijendravarma/next.js my-errorMsg-contribution Change
index.html gzip 576 B 576 B
link.html gzip 588 B 588 B
withRouter.html gzip 569 B 569 B
Overall change 1.73 kB 1.73 kB
Commit: f3fe1d6

@kodiakhq kodiakhq bot merged commit 74b159c into vercel:canary Jul 25, 2021
flybayer pushed a commit to blitz-js/next.js that referenced this pull request Aug 19, 2021
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 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.

3 participants