You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At present I can't seem to see a clean way to use imports inside the src folder and then have those scripts available to importScripts inside a serviceWorker
The use case I'm up against is sharing an idb store where in src it's easy enough to import the idb library and create an object to initialise and look up store items.
When it then comes to using that with a service worker via importScripts I can't seem to think of a neat way to copy across the idb library code etc short of a post build event but that would then require pulling the src file out of the node_modules folder.
The main problem is more so the node module idb I'm then using as I have to make a copy of it to put in the public/scripts/ folder so the service worker can use it.
Is there presently a better way?
The text was updated successfully, but these errors were encountered:
Is your proposal related to a problem?
At present I can't seem to see a clean way to use imports inside the src folder and then have those scripts available to importScripts inside a serviceWorker
The use case I'm up against is sharing an idb store where in src it's easy enough to import the idb library and create an object to initialise and look up store items.
When it then comes to using that with a service worker via importScripts I can't seem to think of a neat way to copy across the idb library code etc short of a post build event but that would then require pulling the src file out of the node_modules folder.
EG
importScripts('/scripts/idb.js'); importScripts('/scripts/idb-store.js');
idb-store.js - Located in src
`import { openDB } from 'idb';
const idbStore = {
db: null,
}
export default idbStore;`
I then have to clone that and alter it slightly for use in public/scripts so my service worker can access it:
`var idbStore = {
db: null,
}`
The main problem is more so the node module idb I'm then using as I have to make a copy of it to put in the public/scripts/ folder so the service worker can use it.
Is there presently a better way?
The text was updated successfully, but these errors were encountered: