Open fluffyball9 opened 3 months ago
Attempting to import {precacheAndRoute} from 'npm:workbox-precaching' in my service worker results in this error:
import {precacheAndRoute} from 'npm:workbox-precaching'
@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)
.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" } }
Parcel should be able to include workbox without throwing an error
idk
Trying to include workbox-precaching in service worker
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'});
navigator.serviceWorker.register(new URL("sw.js", import.meta.url), {type: 'module'});
Using glitch.com if that helps
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
🐛 bug report
Attempting to
import {precacheAndRoute} from 'npm:workbox-precaching'
in my service worker results in this error: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
package.json targets
🤔 Expected Behavior
Parcel should be able to include workbox without throwing an error
😯 Current Behavior
💁 Possible Solution
idk
🔦 Context
Trying to include workbox-precaching in service worker
💻 Code Sample
Sample service worker
imported using
navigator.serviceWorker.register(new URL("sw.js", import.meta.url), {type: 'module'});
🌍 Your Environment
Using glitch.com if that helps