Git Product home page Git Product logo

nextjs-build-id-issue's Introduction

Next.js generateBuildId issue demo

This repo demonstrates an issue where build assets are named differently, depending on the name of the cwd folder, even if generateBuildId (in next.config.js) returns the same ID.

Setup

  1. Clone this repo into two folders:
git clone https://github.com/cullylarson/nextjs-build-id-issue.git nextjs-build-id-issue-1
git clone https://github.com/cullylarson/nextjs-build-id-issue.git nextjs-build-id-issue-2
  1. Build the project in both folders:
cd nextjs-build-id-issue-1
npm install
npm run build
cd ../nextjs-build-id-issue-2
npm install
npm run build
  1. Diff the two build manifests:
diff nextjs-build-id-issue-1/.next/build-manifest.json nextjs-build-id-issue-2/.next/build-manifest.json

Notes

  • Note that generateBuildId in next.config.js returns a constant value. The expectation is that build assets will be named the same because of this.

  • If you build the project twice in the same folder, all of the asset files will be named the same. Even if you delete the .next folder and rebuild, the files will have the same names.

  • This doesn't seem to be fixed by naming the project folders the same, just in different parent directories. It seems to have to do with the full cwd.

  • I've also tried building in one of the project folders, saving the build-manifest.json file, deleting the entire project folder, re-cloning to the same folder name, building again, and comparing the next build-manifest.json to the old one. They're the same.

  • I tried doing the "Setup" described above, saved each manifest, swapped he folder names (e.g. renamed nextjs-build-id-issue-1 to nextjs-build-id-issue-2 and vice versa), removed .nextjs, and rebuilt. The manifests matched the saved versions from their new names (i.e. the build seems to match cwd).

nextjs-build-id-issue's People

Contributors

cullylarson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.