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

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

Open
hidesminimally opened this issue Mar 29, 2021 · 3 comments
Assignees

Comments

@hidesminimally
Copy link

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!

@chandlerprall chandlerprall self-assigned this Mar 29, 2021
@thompsongl
Copy link
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.

@hidesminimally
Copy link
Author

hidesminimally commented Mar 30, 2021

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

@hidesminimally
Copy link
Author

hidesminimally commented Mar 30, 2021

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants