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

Cannot get the plugin to load the sw.js file inside dist folder #84

@titanve

Description

@titanve

Hello everyone!

Can you please help me telling me what is the difference between entry: " ..." and filename: " ..."
?

I've been trying since yesterday to config the plugin but it's been impossible.

My sw_cached_pages.js is in the same folder of the index.js and webpack puts the bundles inside /distfolder

What is the right config in order to load my service worker file and get the serviceWorkerOption variable?

My folder structure is:
+- /spa
--> |- /dist
--> --> |- 1.bundle.js
--> --> |- bundle.js
--> --> |- sw.js <--- 'Generated by the plugin with the bundles list'
--> |- index.js
--> |- webpack.config.js
--> |- sw_cached_pages.js

My plugin config:

new ServiceWorkerWebpackPlugin({
      // entry: path.join(__dirname, "/sw.js"),
      entry: "sw_cached_pages.js",
      // entry: "sw.js",
      filename: "sw_cached_pages.js",
      // excludes: ["**/.*", "**/*.map", "*.html"]
      excludes: ["**/.*", "**/*.map", "*.html"],
      publicPath: "/application/single_pages/visitas/"
    })

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions