Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Bad-precaching-response with themes/min.css when trying to use EUI next.js Starter for PWA #25

Open

Description

@hidesminimally

I'm using EUI's Next.js starter and am trying to make this into a PWA -- here is the repo. I haven't done anything crazy different from the EUI starter. Upon running npm run build; npm run start I get
workbox-030153e1.js:1 Uncaught (in promise) bad-precaching-response: bad-precaching-response :: [{"url":"http://localhost:3000/public/themes/eui_theme_amsterdam_dark.e7b2d22ec11f782218ad.min.css","status":404}

Which I think results the PWA audit in Lighthouse to fail:
image

I've tried excluding the themes/ folder from the caching step but this hasn't worked.

Any ideas?

Thanks in advanced!

Activity

  1. thompsongl commented on Mar 29, 2021

    @thompsongl
    Contributor

    This is just a hunch, but it could be that the theme switching method is the cause. Namely, using <link disabled /> on the unused theme css files.

  2. hidesminimally commented on Mar 30, 2021

    @hidesminimally
    Author

    Thanks for the suggestion @thompsongl - I tried this with this PR - https://github.com/hidesminimally/engram/pull/1 and am at the same place:
    image

    I've also tried next build and have gotten the following error despite my installation of sass in package.json's dependencies and devDependencies:

    info  - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
    info  - Checking validity of types
    @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
    info  - Creating an optimized production build
    Failed to compile.
    
    ./src/pages/app.module.scss
    Error: Cannot find module 'sass'
    Require stack:
    - /usr/local/lib/node_modules/next/dist/compiled/sass-loader/cjs.js
    - /usr/local/lib/node_modules/next/dist/compiled/webpack/bundle4.js
    - /usr/local/lib/node_modules/next/dist/compiled/webpack/webpack.js
    - /usr/local/lib/node_modules/next/dist/next-server/server/config-utils.js
    - /usr/local/lib/node_modules/next/dist/next-server/server/config.js
    - /usr/local/lib/node_modules/next/dist/build/index.js
    - /usr/local/lib/node_modules/next/dist/cli/next-build.js
    - /usr/local/lib/node_modules/next/dist/bin/next
    
    
    > Build error occurred
    Error: > Build failed because of webpack errors
        at /usr/local/lib/node_modules/next/dist/build/index.js:17:924
        at async Span.traceAsyncFn (/usr/local/lib/node_modules/next/dist/telemetry/trace/trace.js:5:584)
    

    Which I think is also a relevant error...

    But interestingly enough, when I deploy it to vercel: https://engram-k3raxj6v1-hidesminimally.vercel.app/ it does not have the sass module loading error. Just the same errors as the original post -- 404 for build-manifest.json (and min.css though I've told the caching to ignore those files for now), which prevent the app from becoming a PWA due to the 404 crashing the serviceworker.js

  3. hidesminimally commented on Mar 30, 2021

    @hidesminimally
    Author

    Update:
    Found a solution for npm run build; npm run start by excluding .json and .min.css from preaching:https://github.com/hidesminimally/engram/pull/1/files#diff-882b2c04b01b2e8b2cdcf1817c30ea503a8005f1c0d54cfff37053b6801fea85R183

    Although I'm not sure this is totally correct because I see this 404 on the vercel deployment:
    https://engram-izzzwf40m-hidesminimally.vercel.app/
    image

    And yet it is able to become a PWA.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions