fab-spec / fab

💎 FAB project specification & monorepo
https://fab.dev
MIT License
579 stars 37 forks source link

build:fab with nextjs picks up files from previous builds #169

Open wizzard0 opened 4 years ago

wizzard0 commented 4 years ago

e.g. after about 10 builds:

      [Compiler] Compiling your server.js:
      [Compiler] Done in 6.07 seconds.
     [Generator] Writing all files to .fab/build
                     /_assets/_next/static/chunks/2d1fb892ad991d9e6642fc990ab158ada56082f7.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/513f634b7c7e5d915d97600a8a81692c3da9df9c.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/531dc5f5a4410093f1dc92a09e47dea73af36585.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/783bb91f701358bec47a1040c6eafd8d7e51e4cc.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/78a2496c88cc382763799dbf185d5682b1dbf65f.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/b96cc6b703fe46db5f4a742c6d731ad9d791a699.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/c739a0c6db9a45acbbebe98df776e6b02d93fcad.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/ceff05ded790a38886c393b37ca4584d79a1c787.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/eb06a83a524a959639dde6eaffbad9def4218f84.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/ed820c581bca6c8030f3f456a1d5fac473a0e2ca.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/f409c59c821bd16db9b0be7c42449b69f54e9934.fe7e92849abaac78ce61.js (30.2 kB)
                     /_assets/_next/static/chunks/framework.c6faae2799416a6da8e8.js (129 kB)
                     /_assets/_next/static/runtime/main-17f801b0476b4ad3e2c4.js (16.4 kB)
                     /_assets/_next/static/runtime/main-5d931d17abb85baf99b3.js (16.4 kB)
                     /_assets/_next/static/runtime/polyfills-10c88b4b028d13fe33de.js (80 kB)
                     /_assets/_next/static/runtime/polyfills-e4875719f3b6f90f1438.js (80 kB)
                     /_assets/_next/static/8BO2zwxPDnZBwRdg70Pty/pages/_error.js (9.05 kB)
                     /_assets/_next/static/8BO2zwxPDnZBwRdg70Pty/pages/index.js (24.9 kB)
                     /_assets/_next/static/CweUicyUfvGoRNRkNoAUN/pages/_error.js (9.05 kB)
                     /_assets/_next/static/CweUicyUfvGoRNRkNoAUN/pages/index.js (24.9 kB)
                     /_assets/_next/static/7eJ03MSzPgilZFjy9so9J/pages/_error.js (9.05 kB)
                     /_assets/_next/static/7eJ03MSzPgilZFjy9so9J/pages/index.js (24.9 kB)
                     /_assets/_next/static/IvfdcF82mHvnBRVC83q1Q/pages/_error.js (9.05 kB)
                     /_assets/_next/static/IvfdcF82mHvnBRVC83q1Q/pages/index.js (24.9 kB)
                     /_assets/_next/static/Z_cseBtc3w79X1TD-ijta/pages/_error.js (9.05 kB)
                     /_assets/_next/static/Z_cseBtc3w79X1TD-ijta/pages/index.js (24.9 kB)
                     /_assets/_next/static/cAMH0SIheo_99wn-9GDx2/pages/_error.js (9.05 kB)
                     /_assets/_next/static/cAMH0SIheo_99wn-9GDx2/pages/index.js (24.9 kB)
                     /_assets/_next/static/cHfK3W74z63X84eRk-H-3/pages/_error.js (9.05 kB)
                     /_assets/_next/static/cHfK3W74z63X84eRk-H-3/pages/index.js (24.9 kB)
                     /_assets/_next/static/q2tNryh11FTNMfQcmaf15/pages/_error.js (9.05 kB)
                     /_assets/_next/static/q2tNryh11FTNMfQcmaf15/pages/index.js (24.9 kB)
                     /_assets/_next/static/u2mCnrm14IXkGRKJPCt0G/pages/_error.js (9.05 kB)
                     /_assets/_next/static/u2mCnrm14IXkGRKJPCt0G/pages/index.js (24.9 kB)
                     /_assets/_next/static/v-ndxDmTfxApkt7rTySs1/pages/_error.js (9.05 kB)
                     /_assets/_next/static/v-ndxDmTfxApkt7rTySs1/pages/index.js (24.9 kB)
                     /_assets/_next/static/yaEGPQrfGdEBTL6TwtZVe/pages/_error.js (9.05 kB)
                     /_assets/_next/static/yaEGPQrfGdEBTL6TwtZVe/pages/index.js (24.9 kB)
                     /_assets/favicon.21b739d43.ico (15.1 kB)
                     /server.js (3.13 MB)

this is not a bug per se, it is needed, so that asset deployment is zero-downtime (if half of the assets were served with new version, and half with old); AND this is likely more of a nextjs\webpack issue, but it might make sense to dedup the assets by md5/sha256, and/or keep "last 2-3 versions" in the future

geelen commented 4 years ago

oh yeah i noticed this the other day, I don't think it was always happening I think something in Next might have changed recently...

Btw, FABs should only ever have the assets for the current version of the code, but when they're deployed they only ever add files to the _assets directory, so all previous versions should still be fine to run.

That's not currently implemented perfectly actually, have raised #170 to remind myself to finish that off.

evanderkoogh commented 4 years ago

@wizzard0, where all of these builds locally? Next won't clean out the .next folder, so if you run a bunch of them on the command line and then build, you would get all the assets. If you remove the .next directly before a build, you should have a clean build.