I use Vuejs and I use workbox-webpack-plugin in order to make my site offline, I want to cache a folder which contains all my files (3 files) like picture below, but when I build my project(using Laravel-mix). The main.js (which contains everything of Vue) cannot be cached in service-woker.js. I tried some ways to fix that but those didn't work.
Does anybody face this issue, do you have any solution, many thanks!
Workbox: cannot cache all files when build project
2.6k views Asked by Duc Trung Mai At
2
There are 2 answers
0
Ritwik Kumar
On
Why are you dealing it manually? Even though you can cache all static asset using
workbox.precaching.precacheAndRoute(self.__precacheManifest || []);
and for dynamic request please use routing with strategy:-
workbox.routing.registerRoute('end point url', workbox.strategies.networkFirst({
cacheName: 'cache-name'
}));
Related Questions in LARAVEL
- Function in anonymous Laravel Blade component
- Composer installation fails and reverts ./composer.json and ./composer.lock to original content
- Laravel: Using belongsToMany relationship with MongoDB
- Laravel's whereBetween method not working with two timestamps
- Implementing UUID as primary key in Laravel intermediate table
- Resolving ElephantIO ServerConnectionFailureException: Error establishing connection to server
- Undefined function getAdminPanelUrlPrefix()'error in Laravel SaaS project after installing chatmessenger
- PHP Laravel SQLServer could not find driver
- Laravel installation via Composer results in connection timeout error
- Is there a way of showing content in a Statamic antlers template if a user is authenticated?
- Livewire component JS script Uncaught SyntaxError: Unexpected token
- is there a solution to run cron job command in cpanel only from my cPanel host?
- Prevent a webpage from navigating away
- Deploy Flutter and Laravel php mobile app on the host server
- Please how I fetch user account balance, withdrawals, Loans and Transactions to display in the dashboard?
Related Questions in CACHING
- Using Puppeteer to scrape a public API only when the data changes
- Caching private wordpress rest endpoints
- Cloudflare not respecting Cache-Control
- Unexpected Recursive Call
- Cannot serialize (Spring Boot)
- Nginx only caches file endpoints
- The Selenium application properties folder holds two environment options. After running a test the environment setting changes to a previous setting
- Launch jobs in cache in a loop in bash script
- Multiple async request do not store anything to cache
- Dev tool for Next.js cache on the client?
- Creating a letter in the terminal by entering
- Laravel: check if cache has key with thag
- The retrieval time for the Apache Ignite cache is too long
- How to run gradle with caches files
- Docker Run cache mount does not cache apt-get dependencies
Related Questions in VUE.JS
- Problems with matter.js and i18n in vue.js
- Form Validation not working in custom component Vue
- Authenticating vue app on each route change
- Vue/TailwindCSS - Content is behind Sidebar
- Vue3 Suspense Parent > Child Animation
- Pass dynamic object data via nuxt-link to component
- Failed to resolve import, but the path is valid, and detected as such by VSCode
- how to use less variables in vue components?
- Prevent a webpage from navigating away
- Creating a modal window in product edit page in Shopware6 and saving data to custom table(repository) from a form within the modal window
- How do I fix (or ignore) a TypeScript error that's inside a HTML template?
- Vue.js Checkbox Alignment Issue: Centering Checkboxes Within Table Cells
- How to reset vue product filter?
- Vue display output of two dimensional array
- vue js error when adding bonus items to another item
Related Questions in LARAVEL-MIX
- Use JavaScript-Class in Script-Tag
- Webpack error when trying to run laravel-mix watch
- Laravel 9 vue with breeze and mix
- How to exclude some vuejs components from being compiled with webpack?
- Mix watch does not update vue router files
- Problem Moving Public Folder When Using Laravel Mix: I Get 404 Error
- Passing props when rendering using h() with children on php laravel-mix
- Prevent webpack/Laravel mix from transforming promises/async to _asyncToGenerator functions
- When setting up a project which uses laravel mix when running mix watch I get the same issue telling me to install sass loader over and over
- Multiple 'You are running Vue in development mode.' & $attrs is readonly. / $listeners is readonly
- How to configure Laravel Mix to access a site in my local network?
- Laravel mix publish images and fonts in different directory under public rather than default one
- Upgrade/migrate from Laravel Mix to Vite
- Issue with rendering a component in Laravel Nova after updating dependencies
- Issue with vue when running npm prod
Related Questions in WORKBOX
- Is there a configurable way to batch workbox-background-sync requests in vite-pwa plugin
- How and when does browser trigger sync event when using workbox-background-sync
- Using workbox precaching multiple pages/route generates cache but cant find match
- Manifest for PWA with scope bind to sub-folder
- BackgroundSync fails when onSync is set
- Vite injects empty array into service-worker (self.__WB_MANIFEST)
- Service Worker and Offline Testing: Insights and Recommendations
- Placing a workbox-build service worker in a subdirectory of the globDirectory
- Building workbox into angular using custom esbuilder
- Failed to load resources with vite pwa plugin in dev mode
- Workbox CacheableResponsePlugin does ignore a specified header while routing a request
- Angular Workbox PWA sync data
- Workbox backgroundSync processing order issue when the user comes online
- React + Vite + VitePWA plugin workbox configurations
- Service worker (Workbox) caching old index.html, but fails to serve app.[hash].js
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)

EDIT: Some time ago, a guy on GitHub helped me figure this out.
It's because there's a Workbox config property called
maximumFileSizeToCacheInBytes. By default it is set to 2MB, which means it will only cache files that are smaller than (or equal to) 2MB. Some of my built files are larger than that. I only needed to increase themaximumFileSizeToCacheInBytesto solve the issue and include those larger files in the generated service worker.My updated Workbox config looks like this: