Comments (4)
Hi @BernardA, are you using TypeScript on your project? The error related to a declaration file seems to be from type definitions not being present.
I don't use TypeScript myself but maybe this article could be of use? https://medium.com/@chris_72272/migrating-to-typescript-write-a-declaration-file-for-a-third-party-npm-module-b1f75808ed2
Can possibly just reuse react-loadable
's definitions as it's the same API as that. A PR would definitely be welcome if you get it working.
With respect to the service worker, I'm guessing that Webpack is resolving to a different URL than the require path. I haven't had a good use for service workers yet but maybe something like this could be useful - https://github.com/oliviertassinari/serviceworker-webpack-plugin
In the past I've just used HTTP caching to do what I believe you're trying to do. Maybe have a look at that also as I've seen service workers cause more harm than good for a various projects.
from react-loadable-visibility.
Thanks @tazsingh. I am not directly using TypeScript. React seems to do that on its own. I will check the article you referenced to, but I am afraid I am not knowledgeable enough to come up with a PR.
Concerning the service worker issue, I will try the plugin you mentioned. Right now I am updating Webpack to v4, from my Symfony Encore installation. Once I got that done, I will check if the fetching from network issue persists. If so, I will install the plugin.
In general I am very pleased with service worker, and it would be fantastic to have react-loadable fetch from cache for all requests subsequent to initial load. I will keep you posted.
By the way, the issue with double posting was that I posted the first time and still saw zero issues open. Same on the second time around. I had actually given up. As you said, it was a temporary glitch on github.
from react-loadable-visibility.
I tried the OfflinePlugin instead of the workbox-webpack-plugin but it did not solve the issue with react-loadable/visibility not fetching from cache.
It would seem that the issue is really with react-loadable/visibility.
from react-loadable-visibility.
Hi @BernardA, it would be impossible for this library to influence caching as there is nothing related to caching or service workers in it. As such, I am closing this issue due to it not being an issue with the way that this library functions.
I'm not sure exactly what you're trying to achieve with a service worker and its caching, however as mentioned above I've used HTTP caching with a long max-age
or even immutable
value as well as Webpack's chunk hash in the filename to achieve the desired effect for me. This is also the more conventional way of handling asynchronous chunk loading. Have you taken a look at that?
from react-loadable-visibility.
Related Issues (20)
- Not working when component itself has more content to cover visible area HOT 3
- Undeclared dependency react-loadable HOT 1
- no declaration file HOT 1
- not working - file is fetched on page load HOT 13
- Enable IntersectionObserver options HOT 3
- Use the 'isIntersecting' attribute as a fallback for zero threshold HOT 1
- How to wait until fetches are complete before showing loadable component? HOT 1
- Enable setting minHeight and minWidth on placeholder div HOT 1
- update to @loadable/components package HOT 2
- Failed to execute 'unobserve' on 'Intersection Observer' HOT 2
- Typescript Typings HOT 5
- Remove props from placeholder div HOT 9
- can I use in react universal? HOT 1
- warning occur when use react-loadable-visibility,but react-loadable is ok HOT 5
- Not working with loadable SSR HOT 4
- window is not defined on server side HOT 2
- LoadableVisibilityComponent doesn't expose loadable's load function. HOT 2
- Is this SEO friendly? HOT 1
- Always render all contents during SSR? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-loadable-visibility.