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

Generate manifest from original. Better export. #59

Merged
merged 3 commits into from
Sep 21, 2018

Conversation

joaovieira
Copy link
Contributor

Luckily the Next 7 builds everything inside /static so the previous version just works 🎉

This PR refactors the logic as discussed in #49 to read the workbox-generated precache manifest instead of generating one from scratch. This should be more reliable moving forward, in case Next.js updates their paths.

On top of that I've made the export functionality using the new exportPathMap options which simplifies massively. #23

Finally, I've removed the hard-coded service-worker.js to use workboxOpts.swDest everywhere. #45

This is not compatible with next@6 so it requires a major bump.

Fixes #49.
Fixes #23.
Fixes #45.

@hanford
Copy link
Owner

hanford commented Sep 21, 2018

Woah! You beat me to it 🔥

I had a WIP but wasn't totally happy with it: https://github.com/hanford/next-offline/tree/export-rewrite

I'll review this today!

@joaovieira
Copy link
Contributor Author

joaovieira commented Sep 21, 2018

I actually thought about mentioning it. But it really just started with the #49, then I got carried away.. 😆But do let me know if you prefer things in any other way!

No rush for the review. I forgot to change the next requirements in package.json. Doing it now.

@hanford
Copy link
Owner

hanford commented Sep 21, 2018

ahh, @joaovieira will we need to make make the next peerDep explicitly 7.0.0+? I'm happy to make this a breaking change and putting this in a 3.0.0 release!

major improvement to the codebase IMO 🍾🍻

@joaovieira
Copy link
Contributor Author

Just did. Yes. That new exportPathMap doesn't work with v6.

{
"printWidth": 100,
"trailingComma": "all",
"singleQuote": true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put some defaults that I use personally. the only difference I think was the trailingComma option. what do you prefer?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing makes sense

"prettier": "^1.14.2",
"pretty-quick": "^1.6.0"
"prettier": "^1.14.3",
"pretty-quick": "^1.7.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused ones and updated all packages

"workbox-webpack-plugin": "^3.5.0"
"fs-extra": "~7.0.0",
"glob": "~7.1.3",
"webpack": "^4.19.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still required by workbox plugin even though it's not a peer dependency 😩

@hanford hanford merged commit 15dec58 into hanford:master Sep 21, 2018
@hanford
Copy link
Owner

hanford commented Sep 21, 2018

Thanks again ❤️

@hanford
Copy link
Owner

hanford commented Sep 21, 2018

Live in 3.0.0 🔥🎉

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

Successfully merging this pull request may close these issues.

2 participants