Comments (1)
A few thoughts on potential approaches here:
One naiive way would be to simply extend the existing code to handle exported modules (i.e. just like we kind of have a URL loader and a simple file loader today, we could add one more). The downside of this is that it's still not API compatible and we are ultimately maintaining a copy of the same code
The most compatible way would be to use the underlying GQL Tools loaders as shown in #650. However, this approach has a few drawbacks. First and foremost...it's slow. While it's acceptably slow for the batch use case, the webpack loader case is slow to the point of making this non-viable. In a project with dozens of GQL files, each file is treated independently by the loader; meaning each builds a separate execContext which reads the schema. This now goes from 1ms to 200ms or more, bringing builds to a crawl. Some of this might be caused by GQL Tools kicking back a Schema object instead of raw file we can hash.
One solution to that problem is to cache the execContext or schema in the loader (since it is a singleton). But now we have the reverse problem, we never reevaluate the schema. So hot reloading is useless. In effect, loaders do not know when the entire build is done, nor do we get a list of files involved in building the schemas such that we could watch them in the loader.
So to actually solve this problem, it's very likely that we should convert the loader to a plugin with a loader component. These two would be able to better coordinate since we could produce a cached schema per build that could be reused for each file. Then on subsequent builds (i.e. hot reloads) we could simply re-create the schema.
from graphql-let.
Related Issues (20)
- Not compatible with typescript-urql-graphcache
- Fragments with Babel macro
- graphql does not generate TypedDocumentNodes that can be inferred by TS 4.5
- fail to builddev or with webpack example - You may need an additional loader to handle the result of these loaders.
- Question: Architecture of cache folder vs adjacent files
- Couldn't find schema.graphqls.d.ts file/s
- Question: Is single file/dir output possible?
- fragment query not response data
- ReferenceError: name is not defined
- Incompatible with Jest 28+
- Webpack config for `graphql-let` breaks HMR HOT 2
- Can `graphql-let` be used with Vite? HOT 1
- Question: improve loader performance HOT 2
- Cache/hash is not busted when using #import statements
- Error: Never. Requested .tsx length and result .d.ts length are not matched. HOT 1
- Absolute imports in graphql files HOT 1
- Critial CVE issues due to hard coded dependency on v2 loader-utils
- Maintaining end & README.md update
- No types getting generated
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 graphql-let.