mischnic / parcel-plugin-sw-cache

📦👷 Parcel plugin for caching using a service worker
https://npm.im/parcel-plugin-sw-cache
MIT License
47 stars 6 forks source link

Inject Error – `No files match the pattern` for replace-in-file #15

Closed Hiswe closed 5 years ago

Hiswe commented 5 years ago

Hi,

me again,

I have this error while using the plugin in inject mode:

UnhandledPromiseRejectionWarning: Error: No files match the pattern: /Users/me/Documents/project/dist/thaime-service-worker.js

This seems to come from the replace function in the inject Promise chain.

Shouldn't it be:

workbox
  .injectManifest(injectOptions)
  // return the promise
  .then(() =>
    replace({
      files: config.swDest || swDest,
      from: /__PUBLIC/g,
      to: publicURL,
    })
  )
  .then(() => printErr('sw-cache: Service worker injection completed.'))
  .catch(error =>
    printErr('sw-cache: Service worker injection failed: ' + error)
  )

If this is really an error, I can come with a PR :)

mischnic commented 5 years ago

If this is really an error, I can come with a PR :)

I think you're right, please do 👍

Hiswe commented 5 years ago

done in #16

Hiswe commented 5 years ago

@mischnic Thanks for publishing the fix! It's all good now :)