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
If there is a comment in the .graphql file e.g. ${FIELD} ${OPERATOR}..., this breaks the generated file as it would treat them as a string interpolation due to backticks being used to wrap the export.
My solution is to replace ${ with \${, since $ is a valid symbol in graphql.
Here is the diff that solved my problem:
diff --git a/node_modules/graphql-import-loader/dist/src/index.js b/node_modules/graphql-import-loader/dist/src/index.js
index be4fa7b..ae741f9 100644
--- a/node_modules/graphql-import-loader/dist/src/index.js+++ b/node_modules/graphql-import-loader/dist/src/index.js@@ -4,7 +4,7 @@ var graphql_import_1 = require("graphql-import");
function default_1(source) {
var callback = this.async();
this.cacheable();
- callback(null, "module.exports = `" + graphql_import_1.importSchema(source).replace(/`/g, '\\`') + "`");+ callback(null, "module.exports = `" + graphql_import_1.importSchema(source).replace(/`/g, '\\`').replace(/\${/g, '\\${') + "`");
}
exports.default = default_1;
//# sourceMappingURL=index.js.map
\ No newline at end of file
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.If there is a comment in the
.graphql
file e.g.${FIELD} ${OPERATOR}...
, this breaks the generated file as it would treat them as a string interpolation due to backticks being used to wrap the export.My solution is to replace
${
with\${
, since$
is a valid symbol in graphql.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: