Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sourcemaps are generated incorrectly (exchange-graphcache) #3182

Closed
bosycom opened this issue Apr 25, 2023 · 1 comment · Fixed by #3201
Closed

sourcemaps are generated incorrectly (exchange-graphcache) #3182

bosycom opened this issue Apr 25, 2023 · 1 comment · Fixed by #3201

Comments

@bosycom
Copy link

bosycom commented Apr 25, 2023

Problem

Trying to debug cacheExchange:

import { cacheExchange } from "@urql/exchange-graphcache";
// ...
const cache = cacheExchange({});

loads urql-exchange-graphcache.mjs and its .map file in Chrome dev tools, but breaks in the middle of a comment in line 60 of /exchanges/graphcache/src/cacheExchange.ts in my app.

Additionally, to check that it is not necessarily just an issue with my setup, I used source map visualizer here from https://sokra.github.io/source-map-visualization/#custom
I uploaded the files and came to the same result as can be seen here:

image

Are source maps generated incorrectly?
Any help is appreciated which would help me on my way to understand graphcache better.

@kitten
Copy link
Member

kitten commented Apr 25, 2023

Hiya 👋
I'll have to have a look at this tomorrow. Quick note on this, I'd assume that something's still off with our original file sources in the source map itself or the Rollup generation of them. We had an issue not too long ago where the inclusion of the typescript plugin (or any other plugin that uses typescript) would prevent sourcemaps from being generated correctly 🤔

However, I assumed that removing the TS plugins entirely from our build chain would've resolved this.

resolve({
dedupe: settings.externalModules,
extensions: ['.js', '.ts'],
mainFields: ['module', 'jsnext', 'main'],
preferBuiltins: false,
browser: true
}),
commonjs({
ignoreGlobal: true,
include: /\/node_modules\//,
namedExports: settings.hasReact ? {
react: Object.keys(React)
} : {},
}),
];
export const makePlugins = () => [
...makeBasePlugins(),
sucrase({
exclude: ['node_modules/**'],
transforms: ['typescript']
}),

I assume that there's still an underlying issue that prevents them from working correctly, so I guess we'll have to investigate this further.

On a side note, if you need any more information on how Graphcache works and such, feel free to send me questions over on the Discord directly, since that may be quicker for you than to sift through what you're looking for. I also have a higher level explanation of it in a blog post, however, some newer parts aren't covered in there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants