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

[Feature request]: next dev --turbo support #54

Open
leerob opened this issue Jan 27, 2024 · 4 comments
Open

[Feature request]: next dev --turbo support #54

leerob opened this issue Jan 27, 2024 · 4 comments
Assignees
Labels
feature request This is a feature request no stale This should not go stale

Comments

@leerob
Copy link

leerob commented Jan 27, 2024

Which project is this feature request for?

@serwist/next

Describe the feature you'd like to request

It would be awesome to have a version of Serwist that works with turbopack.

Describe the solution you'd like

https://turbo.build/pack/docs/features/customizing-turbopack#webpack-loaders-for-nextjs

Describe alternatives you've considered

Webpack 😄

@leerob leerob added feature request This is a feature request triage New issues get this label, remove it after triage labels Jan 27, 2024
@leerob leerob changed the title [Feature request]: next dev --turbo support [Feature request]: next dev --turbo support Jan 27, 2024
@DuCanhGH
Copy link
Member

DuCanhGH commented Jan 28, 2024

It would be awesome to have a version of Serwist that works with turbopack.

I agree! However, it seems to be not really feasible at the moment.

Since Turbopack isn't configurable through plugins yet, our only options to provide rudimentary support for Turbopack would be to either introduce a post-build script that the user runs manually, which would only work for next build --turbo (which doesn't seem to be a thing yet?) and would be really limited, for we are not able to access things the likes of webpack config, fully resolved Next.js config, etc., or write a Turbopack loader as suggested, but I'm not really sure as to when this loader is run.

If it is run after the build script is done with static files such as ".next/static/chunks/**/*.js", which seems to be unlikely, then we can make it work. Otherwise, we may as well just wait for Turbopack's plugin support.

At the moment though, since next build --turbo seemingly isn't supported yet, I believe using the normal @serwist/next should just work and Turbopack support needn't already be a priority yet. This is because most simple use cases don't really need having a service worker in development mode. However, if one's use case is more complex, perhaps their only choice is to temporarily make do with webpack or not use Serwist.

I hope you understand the situation...

@DuCanhGH DuCanhGH added help wanted Extra attention is needed no stale This should not go stale and removed triage New issues get this label, remove it after triage help wanted Extra attention is needed labels Jan 28, 2024
@bestickley
Copy link

@leerob, any updates on when Turbopack will support plugins?

@leerob
Copy link
Author

leerob commented May 10, 2024

Hey! It supports some today: https://nextjs.org/docs/app/api-reference/next-config-js/turbo#webpack-loaders

@bestickley
Copy link

@leerob, thanks for the response. My understanding of loaders vs plugins is that loaders only allow you to transform a single file whereas plugins allow customization over build process. See more here). I think the next serwist plugin requires more customization over the build process than just modifying single files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request This is a feature request no stale This should not go stale
Projects
None yet
Development

No branches or pull requests

3 participants