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

Unable to add workbox-precaching to service worker #9922

Open
fluffyball9 opened this issue Aug 19, 2024 · 1 comment
Open

Unable to add workbox-precaching to service worker #9922

fluffyball9 opened this issue Aug 19, 2024 · 1 comment

Comments

@fluffyball9
Copy link

fluffyball9 commented Aug 19, 2024

🐛 bug report

Attempting to import {precacheAndRoute} from 'npm:workbox-precaching' in my service worker results in this error:

@parcel/core: Failed to resolve 'd87982a6ed0e5ad6:./index.js:esm' from '.../node_modules/workbox-precaching/index.mjs'

  .../node_modules/workbox-precaching/index.mjs:1:8
  > 1 | export * from './index.js';
  >   |        ^^^^^^^^^^^^^^^^^^^^^

@parcel/resolver-default: Unknown url scheme or pipeline 'd87982a6ed0e5ad6:'

with ... being an absolute path to node_modules (not in default location as glitch symlinks node_modules to a different location)

🎛 Configuration (.babelrc, package.json, cli command)

.parcelrc

{
  "extends": "@parcel/config-default",
  "namers": ["./parcelNamer.js"],
  "transformers": {
    "*.js": ["./parcelTransformer.js", "..."]
  },
  "compressors": {
    "*.*": [
      "...",
      "@parcel/compressor-gzip",
      "@parcel/compressor-brotli"
    ]
  }
}

package.json targets

"targets": {
  "default": {
    "sourceMap": false,
    "outputFormat": "global",
    "context": "browser"
  }
}

🤔 Expected Behavior

Parcel should be able to include workbox without throwing an error

😯 Current Behavior

@parcel/core: Failed to resolve 'd87982a6ed0e5ad6:./index.js:esm' from '.../node_modules/workbox-precaching/index.mjs'

  .../node_modules/workbox-precaching/index.mjs:1:8
  > 1 | export * from './index.js';
  >   |        ^^^^^^^^^^^^^^^^^^^^^

@parcel/resolver-default: Unknown url scheme or pipeline 'd87982a6ed0e5ad6:'

💁 Possible Solution

idk

🔦 Context

Trying to include workbox-precaching in service worker

💻 Code Sample

Sample service worker

import {precacheAndRoute} from 'npm:workbox-precaching';
precacheAndRoute(self.__WB_MANIFEST);

imported using navigator.serviceWorker.register(new URL("sw.js", import.meta.url), {type: 'module'});

🌍 Your Environment

Software Version(s)
Parcel 2.12.0
Node 16.14.2
npm 7.20.6
Operating System Ubuntu 16.04

Using glitch.com if that helps

@fluffyball9
Copy link
Author

My guess now is that it has something to do with node_modules being a symlink to a different directory as this works fine locally on my windows computer

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

No branches or pull requests

1 participant