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

Error when exporting to static directory #20969

Merged
merged 4 commits into from Jan 11, 2021

Conversation

timneutkens
Copy link
Member

Fixes #20408
Fixes #20925

@ijjk
Copy link
Member

ijjk commented Jan 11, 2021

Failing test suites

Commit: feec268

test/integration/errors-on-output-to-static/test/index.test.js

  • Errors on output to public > Throws error when distDir is set to public
  • Errors on output to public > Throws error when export out dir is public
Expand output

● Errors on output to public › Throws error when distDir is set to public

expect(received).toMatch(expected)

Expected pattern: /The 'static' directory is reserved in Next\.js and can not be set as/
Received string:  "
> Build error occurred
Error: The 'public' directory is reserved in Next.js and can not be set as the 'distDir'. https://err.sh/vercel/next.js/can-not-output-to-public

  1 | "use strict";exports.__esModule=true;exports.normalizeConfig=normalizeConfig;exports.default=loadConfig;exports.isTargetLikeServerless=isTargetLikeServerless;var _chalk=_interopRequireDefault(require("chalk"));var _findUp=_interopRequireDefault(require("next/dist/compiled/find-up"));var _os=_interopRequireDefault(require("os"));var _path=require("path");var _utils=require("../lib/utils");var Log=_interopRequireWildcard(require("../../build/output/log"));var _constants=require("../lib/constants");var _imageConfig=require("./image-config");function _getRequireWildcardCache(){if(typeof WeakMap!=="function")return null;var cache=new WeakMap();_getRequireWildcardCache=function(){return cache;};return cache;}function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache();if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const targets=['server','serverless','experimental-serverless-trace'];const reactModes=['legacy','blocking','concurrent'];const defaultConfig={env:[],webpack:null,webpackDevMiddleware:null,distDir:'.next',assetPrefix:'',configOrigin:'default',useFileSystemPublicRoutes:true,generateBuildId:()=>null,generateEtags:true,pageExtensions:['tsx','ts','jsx','js'],target:'server',poweredByHeader:true,compress:true,analyticsId:process.env.VERCEL_ANALYTICS_ID||'',images:_imageConfig.imageConfigDefault,devIndicators:{buildActivity:true},onDemandEntries:{maxInactiveAge:60*1000,pagesBufferLength:2},amp:{canonicalBase:''},basePath:'',sassOptions:{},trailingSlash:false,i18n:null,productionBrowserSourceMaps:false,experimental:{cpus:Math.max(1,(Number(process.env.CIRCLE_NODE_TOTAL)||(_os.default.cpus()||{length:1}).length)-1),plugins:false,profiling:false,sprFlushToDisk:true,reactMode:'legacy',workerThreads:false,pageEnv:false,optimizeFonts:false,optimizeImages:false,optimizeCss:false,scrollRestoration:false,scriptLoader:false},future:{excludeDefaultMomentLocales:false},serverRuntimeConfig:{},publicRuntimeConfig:{},reactStrictMode:false};const experimentalWarning=(0,_utils.execOnce)(()=>{Log.warn(_chalk.default.bold('You have enabled experimental feature(s).'));Log.warn(`Experimental features are not covered by semver, and may cause unexpected or broken application behavior. `+`Use them at your own risk.`);console.warn();});function assignDefaults(userConfig){if(typeof userConfig.exportTrailingSlash!=='undefined'){console.warn(_chalk.default.yellow.bold('Warning: ')+'The "exportTrailingSlash" option has been renamed to "trailingSlash". Please update your next.config.js.');if(typeof userConfig.trailingSlash==='undefined'){userConfig.trailingSlash=userConfig.exportTrailingSlash;}delete userConfig.exportTrailingSlash;}const config=Object.keys(userConfig).reduce((currentConfig,key)=>{const value=userConfig[key];if(value===undefined||value===null){return currentConfig;}if(key==='experimental'&&value&&value!==defaultConfig[key]){experimentalWarning();}if(key==='distDir'){if(typeof value!=='string'){throw new Error(`Specified distDir is not a string, found type "${typeof value}"`);}const userDistDir=value.trim();// don't allow public as the distDir as this is a reserved folder for
  2 | // public files
> 3 | if(userDistDir==='public'){throw new Error(`The 'public' directory is reserved in Next.js and can not be set as the 'distDir'. https://err.sh/vercel/next.js/can-not-output-to-public`);}// make sure distDir isn't an empty string as it can result in the provided
    |                                  ^
  4 | // directory being deleted in development mode
  5 | if(userDistDir.length===0){throw new Error(`Invalid distDir provided, distDir can not be an empty string. Please remove this config or set it to undefined`);}}if(key==='pageExtensions'){if(!Array.isArray(value)){throw new Error(`Specified pageExtensions is not an array of strings, found "${value}". Please update this config or remove it.`);}if(!value.length){throw new Error(`Specified pageExtensions is an empty array. Please update it with the relevant extensions or remove it.`);}value.forEach(ext=>{if(typeof ext!=='string'){throw new Error(`Specified pageExtensions is not an array of strings, found "${ext}" of type "${typeof ext}". Please update this config or remove it.`);}});}if(!!value&&value.constructor===Object){currentConfig[key]={...defaultConfig[key],...Object.keys(value).reduce((c,k)=>{const v=value[k];if(v!==undefined&&v!==null){c[k]=v;}return c;},{})};}else{currentConfig[key]=value;}return currentConfig;},{});const result={...defaultConfig,...config};if(typeof result.assetPrefix!=='string'){throw new Error(`Specified assetPrefix is not a string, found type "${typeof result.assetPrefix}" https://err.sh/vercel/next.js/invalid-assetprefix`);}if(typeof result.basePath!=='string'){throw new Error(`Specified basePath is not a string, found type "${typeof result.basePath}"`);}if(result.basePath!==''){if(result.basePath==='/'){throw new Error(`Specified basePath /. basePath has to be either an empty string or a path prefix"`);}if(!result.basePath.startsWith('/')){throw new Error(`Specified basePath has to start with a /, found "${result.basePath}"`);}if(result.basePath!=='/'){if(result.basePath.endsWith('/')){throw new Error(`Specified basePath should not end with /, found "${result.basePath}"`);}if(result.assetPrefix===''){result.assetPrefix=result.basePath;}if(result.amp.canonicalBase===''){result.amp.canonicalBase=result.basePath;}}}if(result!=null&&result.images){const images=result.images;if(typeof images!=='object'){throw new Error(`Specified images should be an object received ${typeof images}.\nSee more info here: https://err.sh/next.js/invalid-images-config`);}if(images.domains){if(!Array.isArray(images.domains)){throw new Error(`Specified images.domains should be an Array received ${typeof images.domains}.\nSee more info here: https://err.sh/next.js/invalid-images-config`);}if(images.domains.length>50){throw new Error(`Specified images.domains exceeds length of 50, received length (${images.domains.length}), please reduce the length of the array to continue.\nSee more info here: https://err.sh/next.js/invalid-images-config`);}const invalid=images.domains.filter(d=>typeof d!=='string');if(invalid.length>0){throw new Error(`Specified images.domains should be an Array of strings received invalid values (${invalid.join(', ')}).\nSee more info here: https://err.sh/next.js/invalid-images-config`);}}if(images.deviceSizes){const{deviceSizes}=images;if(!Array.isArray(deviceSizes)){throw new Error(`Specified images.deviceSizes should be an Array received ${typeof deviceSizes}.\nSee more info here: https://err.sh/next.js/invalid-images-config`);}if(deviceSizes.length>25){throw new Error(`Specified images.deviceSizes exceeds length of 25, received length (${deviceSizes.length}), please reduce the length of the array to continue.\nSee more info here: https://err.sh/next.js/invalid-images-config`);}const invalid=deviceSizes.filter(d=>{return typeof d!=='number'||d<1||d>10000;});if(invalid.length>0){throw new Error(`Specified images.deviceSizes should be an Array of numbers that are between 1 and 10000, received invalid values (${invalid.join(', ')}).\nSee more info here: https://err.sh/next.js/invalid-images-config`);}}if(images.imageSizes){const{imageSizes}=images;if(!Array.isArray(imageSizes)){throw new Error(`Specified images.imageSizes should be an Array received ${typeof imageSizes}.\nSee more info here: https://err.sh/next.js/invalid-images-config`);}if(imageSizes.length>25){throw new Error(`Specified images.imageSizes exceeds length of 25, received length (${imageSizes.length}), please reduce the length of the array to continue.\nSee more info here: https://err.sh/next.js/invalid-images-config`);}const invalid=imageSizes.filter(d=>{return typeof d!=='number'||d<1||d>10000;});if(invalid.length>0){throw new Error(`Specified images.imageSizes should be an Array of numbers that are between 1 and 10000, received invalid values (${invalid.join(', ')}).\nSee more info here: https://err.sh/next.js/invalid-images-config`);}}if(!images.loader){images.loader='default';}if(!_imageConfig.VALID_LOADERS.includes(images.loader)){throw new Error(`Specified images.loader should be one of (${_imageConfig.VALID_LOADERS.join(', ')}), received invalid value (${images.loader}).\nSee more info here: https://err.sh/next.js/invalid-images-config`);}// Append trailing slash for non-default loaders
  6 | if(images.path){if(images.loader!=='default'&&images.path[images.path.length-1]!=='/'){images.path+='/';}}if(images.path===_imageConfig.imageConfigDefault.path&&result.basePath){images.path=`${result.basePath}${images.path}`;}}if(result.i18n){const{i18n}=result;const i18nType=typeof i18n;if(i18nType!=='object'){throw new Error(`Specified i18n should be an object received ${i18nType}.\nSee more info here: https://err.sh/next.js/invalid-i18n-config`);}if(!Array.isArray(i18n.locales)){throw new Error(`Specified i18n.locales should be an Array received ${typeof i18n.locales}.\nSee more info here: https://err.sh/next.js/invalid-i18n-config`);}const defaultLocaleType=typeof i18n.defaultLocale;if(!i18n.defaultLocale||defaultLocaleType!=='string'){throw new Error(`Specified i18n.defaultLocale should be a string.\nSee more info here: https://err.sh/next.js/invalid-i18n-config`);}if(typeof i18n.domains!=='undefined'&&!Array.isArray(i18n.domains)){throw new Error(`Specified i18n.domains must be an array of domain objects e.g. [ { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] } ] received ${typeof i18n.domains}.\nSee more info here: https://err.sh/next.js/invalid-i18n-config`);}if(i18n.domains){const invalidDomainItems=i18n.domains.filter(item=>{if(!item||typeof item!=='object')return true;if(!item.defaultLocale)return true;if(!item.domain||typeof item.domain!=='string')return true;let hasInvalidLocale=false;if(Array.isArray(item.locales)){for(const locale of item.locales){if(typeof locale!=='string')hasInvalidLocale=true;for(const domainItem of i18n.domains||[]){if(domainItem===item)continue;if(domainItem.locales&&domainItem.locales.includes(locale)){console.warn(`Both ${item.domain} and ${domainItem.domain} configured the locale (${locale}) but only one can. Remove it from one i18n.domains config to continue`);hasInvalidLocale=true;break;}}}}return hasInvalidLocale;});if(invalidDomainItems.length>0){throw new Error(`Invalid i18n.domains values:\n${invalidDomainItems.map(item=>JSON.stringify(item)).join('\n')}\n\ndomains value must follow format { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] }.\nSee more info here: https://err.sh/next.js/invalid-i18n-config`);}}if(!Array.isArray(i18n.locales)){throw new Error(`Specified i18n.locales must be an array of locale strings e.g. ["en-US", "nl-NL"] received ${typeof i18n.locales}.\nSee more info here: https://err.sh/next.js/invalid-i18n-config`);}const invalidLocales=i18n.locales.filter(locale=>typeof locale!=='string');if(invalidLocales.length>0){throw new Error(`Specified i18n.locales contains invalid values (${invalidLocales.map(String).join(', ')}), locales must be valid locale tags provided as strings e.g. "en-US".\n`+`See here for list of valid language sub-tags: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry`);}if(!i18n.locales.includes(i18n.defaultLocale)){throw new Error(`Specified i18n.defaultLocale should be included in i18n.locales.\nSee more info here: https://err.sh/next.js/invalid-i18n-config`);}// make sure default Locale is at the front

  at ../packages/next/dist/next-server/server/config.js:3:34
      at Array.reduce (<anonymous>)
  at assignDefaults (../packages/next/dist/next-server/server/config.js:1:3314)
  at loadConfig (../packages/next/dist/next-server/server/config.js:8:1081)
  at ../packages/next/dist/build/index.js:2:227
  at ../packages/next/dist/build/tracer.js:1:415
  at NoopTracer.withSpan (../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:47:16)
  at ProxyTracer.withSpan (../node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:34)
  at traceFn (../packages/next/dist/build/tracer.js:1:385)
  at ../packages/next/dist/build/index.js:2:158
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:525
  "
  at Object.<anonymous> (integration/errors-on-output-to-static/test/index.test.js:15:45)

● Errors on output to public › Throws error when export out dir is public

expect(received).toMatch(expected)

Expected pattern: /The 'static' directory is reserved in Next\.js and can not be used as/
Received string:  "info  - using build directory: /home/runner/work/next.js/next.js/test/integration/errors-on-output-to-static/.next
Error: The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://err.sh/vercel/next.js/can-not-output-to-public

   9 | // can manually add it to the `exportPathMap`.
  10 | if((_prerenderManifest=prerenderManifest)!=null&&_prerenderManifest.dynamicRoutes[page]){excludedPrerenderRoutes.add(page);continue;}defaultPathMap[page]={page};}// Initialize the output directory
> 11 | const outDir=options.outdir;if(outDir===(0,_path.join)(dir,'public')){throw new Error(`The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://err.sh/vercel/next.js/can-not-output-to-public`);}if(outDir===(0,_path.join)(dir,'static')){throw new Error(`The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://err.sh/vercel/next.js/can-not-output-to-static`);}await(0,_recursiveDelete.recursiveDelete)((0,_path.join)(outDir));await _fs.promises.mkdir((0,_path.join)(outDir,'_next',buildId),{recursive:true});(0,_fs.writeFileSync)((0,_path.join)(distDir,_constants2.EXPORT_DETAIL),JSON.stringify({version:1,outDirectory:outDir,success:false}),'utf8');// Copy static directory
     |                                                                             ^
  12 | if(!options.buildExport&&(0,_fs.existsSync)((0,_path.join)(dir,'static'))){if(!options.silent){Log.info('Copying "static" directory');}await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('copy-static-directory'),()=>(0,_recursiveCopy.recursiveCopy)((0,_path.join)(dir,'static'),(0,_path.join)(outDir,'static')));}// Copy .next/static directory
  13 | if(!options.buildExport&&(0,_fs.existsSync)((0,_path.join)(distDir,_constants2.CLIENT_STATIC_FILES_PATH))){if(!options.silent){Log.info('Copying "static build" directory');}await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('copy-next-static-directory'),()=>(0,_recursiveCopy.recursiveCopy)((0,_path.join)(distDir,_constants2.CLIENT_STATIC_FILES_PATH),(0,_path.join)(outDir,'_next',_constants2.CLIENT_STATIC_FILES_PATH)));}// Get the exportPathMap from the config file
  14 | if(typeof nextConfig.exportPathMap!=='function'){if(!options.silent){Log.info(`No "exportPathMap" found in "${_constants2.CONFIG_FILE}". Generating map from "./pages"`);}nextConfig.exportPathMap=async defaultMap=>{return defaultMap;};}const{i18n,images:{loader='default'}}=nextConfig;if(i18n&&!options.buildExport){throw new Error(`i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/deployment`);}if(!options.buildExport){const{isNextImageImported}=await(0,_tracer.traceAsyncFn)(_tracer.tracer.startSpan('is-next-image-imported'),()=>_fs.promises.readFile((0,_path.join)(distDir,_constants2.EXPORT_MARKER),'utf8').then(text=>JSON.parse(text)).catch(()=>({})));if(isNextImageImported&&loader==='default'&&!_ciInfo.hasNextSupport){throw new Error(`Image Optimization using Next.js' default loader is not compatible with \`next export\`.

  at ../packages/next/dist/export/index.js:11:77
  at ../async /home/runner/work/next.js/next.js/packages/next/dist/build/tracer.js:1:525
  "
  at Object.<anonymous> (integration/errors-on-output-to-static/test/index.test.js:33:45)

@ijjk
Copy link
Member

ijjk commented Jan 11, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
buildDuration 10.3s 10.2s -109ms
nodeModulesSize 80.9 MB 80.9 MB ⚠️ +563 B
Page Load Tests Overall increase ✓
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
/ failed reqs 0 0
/ total time (seconds) 2.065 2.08 ⚠️ +0.02
/ avg req/sec 1210.47 1202 ⚠️ -8.47
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.272 1.253 -0.02
/error-in-render avg req/sec 1965.8 1994.65 +28.85
Client Bundles (main, webpack, commons)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
index.html gzip 614 B 614 B
link.html gzip 619 B 619 B
withRouter.html gzip 606 B 606 B
Overall change 1.84 kB 1.84 kB

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

@ijjk
Copy link
Member

ijjk commented Jan 11, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
buildDuration 10.3s 10.3s -30ms
nodeModulesSize 80.9 MB 80.9 MB ⚠️ +563 B
Page Load Tests Overall increase ✓
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
/ failed reqs 0 0
/ total time (seconds) 2.048 2.052 0
/ avg req/sec 1220.49 1218.17 ⚠️ -2.32
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.336 1.262 -0.07
/error-in-render avg req/sec 1870.97 1981.38 +110.41
Client Bundles (main, webpack, commons)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
index.html gzip 614 B 614 B
link.html gzip 619 B 619 B
withRouter.html gzip 606 B 606 B
Overall change 1.84 kB 1.84 kB

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

@ijjk
Copy link
Member

ijjk commented Jan 11, 2021

Failing test suites

Commit: 10ddb57

test/integration/errors-on-output-to-static/test/index.test.js

  • Errors on output to static > Throws error when distDir is set to static
Expand output

● Errors on output to static › Throws error when distDir is set to static

expect(received).toMatch(expected)

Expected pattern: /The 'static' directory is reserved in Next\.js and can not be set as/
Received string:  "info  - Creating an optimized production build...
info  - Using external babel configuration from /home/runner/work/next.js/next.js/test/.babelrc
info  - Compiled successfully
info  - Collecting page data...
info  - Generating static pages (0/2)
info  - Generating static pages (2/2)
info  - Finalizing page optimization...·
Page                                                           Size     First Load JS
┌ ○ /                                                          183 B            62 kB
└ ○ /404                                                       3.47 kB        65.3 kB
+ First Load JS shared by all                                  61.8 kB
  ├ chunks/f6078781a05fe1bcb0902d23dbbb2662c8d200b3.a52c41.js  13.3 kB
  ├ chunks/framework.97b78d.js                                 40.4 kB
  ├ chunks/main.339953.js                                      6.4 kB
  ├ chunks/pages/_app.0cc80b.js                                1 kB
  └ chunks/webpack.50bee0.js                                   751 B·
λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
   (ISR)     incremental static regeneration (uses revalidate in getStaticProps)·
"

  13 |     await fs.writeFile(nextConfig, `module.exports = { distDir: 'static' }`)
  14 |     const results = await nextBuild(appDir, [], { stdout: true, stderr: true })
> 15 |     expect(results.stdout + results.stderr).toMatch(
     |                                             ^
  16 |       /The 'static' directory is reserved in Next\.js and can not be set as/
  17 |     )
  18 |     await fs.remove(nextConfig)

  at Object.<anonymous> (integration/errors-on-output-to-static/test/index.test.js:15:45)

@ijjk
Copy link
Member

ijjk commented Jan 11, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
buildDuration 9.8s 9.5s -353ms
nodeModulesSize 80.9 MB 80.9 MB ⚠️ +563 B
Page Load Tests Overall increase ✓
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
/ failed reqs 0 0
/ total time (seconds) 1.966 1.628 -0.34
/ avg req/sec 1271.75 1535.77 +264.02
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.242 1.029 -0.21
/error-in-render avg req/sec 2012.35 2428.71 +416.36
Client Bundles (main, webpack, commons)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
index.html gzip 614 B 614 B
link.html gzip 619 B 619 B
withRouter.html gzip 606 B 606 B
Overall change 1.84 kB 1.84 kB

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

@ijjk
Copy link
Member

ijjk commented Jan 11, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
buildDuration 8.5s 8.7s ⚠️ +132ms
nodeModulesSize 80.9 MB 80.9 MB ⚠️ +563 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
/ failed reqs 0 0
/ total time (seconds) 1.698 1.729 ⚠️ +0.03
/ avg req/sec 1471.95 1446.1 ⚠️ -25.85
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.054 1.09 ⚠️ +0.04
/error-in-render avg req/sec 2372.75 2293.11 ⚠️ -79.64
Client Bundles (main, webpack, commons)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
index.html gzip 614 B 614 B
link.html gzip 619 B 619 B
withRouter.html gzip 606 B 606 B
Overall change 1.84 kB 1.84 kB

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

@ijjk
Copy link
Member

ijjk commented Jan 11, 2021

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
buildDuration 9.3s 10.9s ⚠️ +1.7s
nodeModulesSize 80.9 MB 80.9 MB ⚠️ +563 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
/ failed reqs 0 0
/ total time (seconds) 1.889 1.927 ⚠️ +0.04
/ avg req/sec 1323.45 1297.54 ⚠️ -25.91
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.188 1.205 ⚠️ +0.02
/error-in-render avg req/sec 2103.79 2074.56 ⚠️ -29.23
Client Bundles (main, webpack, commons)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
677f882d2ed8..89aa.js gzip 13.1 kB 13.1 kB
framework.HASH.js gzip 39 kB 39 kB
main-dba4ec1..27c0.js gzip 6.63 kB 6.63 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.4 kB 59.4 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-e2ffa..0f3f.js gzip 3.46 kB 3.46 kB
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-d979103..c5ff.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.09 kB 8.09 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/error-on-static-dir Change
index.html gzip 614 B 614 B
link.html gzip 619 B 619 B
withRouter.html gzip 606 B 606 B
Overall change 1.84 kB 1.84 kB

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

@kodiakhq kodiakhq bot merged commit 4dc0779 into vercel:canary Jan 11, 2021
@timneutkens timneutkens deleted the fix/error-on-static-dir branch January 11, 2021 14:50
@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception happened when export directory is named 'static'
3 participants