Skip to content

vue-cli-pwa serves some weird service-worker.js. Service Workers are not just for caching. #4801

@MichaelJCole

Description

@MichaelJCole

Version

4.0.5

Reproduction link

https://www.npmjs.com/package/@vue/cli-plugin-pwa

localhost:8080/service-worker.js is returning some weird code I didn't write.

Reading the docs, the plugin is doing this to prevent "caching problems".

Service Workers can do more than "caching", and running Service Workers in development is necessary to develop application features that depend on them.

Steps to reproduce

Read the docs here:

https://www.npmjs.com/package/@vue/cli-plugin-pwa

The docs indicate I should compile for production, then do development. This doesn't make sense.

Also, the plugin serves non-functional code that I didn't write into my application. There doesn't seem to be a way to override this feature, and run my code in development.

Here is the plugin code:
https://github.com/MichaelJCole/vue-cli/blob/dev/packages/%40vue/cli-plugin-pwa/index.js

How can I run my service worker in development?

What is expected?

To run my code.

What is actually happening?

Some weird code I didn't write is running.

Metadata

Metadata

Assignees

No one assigned

    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