Closed rrdelaney closed 2 years ago
@rrdelaney You are right, the extension no longer depends on apollo-language-server and the code in included in the extension package directly (https://github.com/apollographql/vscode-graphql/tree/main/src). I managed to get it working again with this patch.
diff --git a/node_modules/vscode-apollo-relay/dist/dependencies.js b/node_modules/vscode-apollo-relay/dist/dependencies.js
index 6bef19c..9b7ced4 100644
--- a/node_modules/vscode-apollo-relay/dist/dependencies.js
+++ b/node_modules/vscode-apollo-relay/dist/dependencies.js
@@ -7,16 +7,8 @@
var _a;
exports.__esModule = true;
exports.RelayCompilerMain = exports.RelayConfig = exports.suggestionList = exports.didYouMean = exports.TypeInfo = exports.isInputType = exports.visitWithTypeInfo = exports.GraphQLObjectType = exports.GraphQLNonNull = exports.typeFromAST = exports.getNullableType = exports.isTypeSubTypeOf = exports.valueFromAST = exports.isNonNullType = exports.visit = exports.parseType = exports.GraphQLError = exports.BREAK = exports.defaultValidationRules = void 0;
-var mod = module;
-if (typeof jest === "undefined") {
- while (mod && !mod.id.includes("apollographql.vscode-apollo")) {
- mod = mod.parent;
- }
- if (mod === null) {
- throw new Error("Unable to find vscode-apollo's node_modules");
- }
-}
-exports.defaultValidationRules = mod.require("apollo-language-server/lib/errors/validation").defaultValidationRules;
+var mod = require.main;
+exports.defaultValidationRules = mod.require("./errors/validation").defaultValidationRules;
exports.BREAK = (_a = mod.require("graphql"), _a.BREAK), exports.GraphQLError = _a.GraphQLError, exports.parseType = _a.parseType, exports.visit = _a.visit, exports.isNonNullType = _a.isNonNullType, exports.valueFromAST = _a.valueFromAST, exports.isTypeSubTypeOf = _a.isTypeSubTypeOf, exports.getNullableType = _a.getNullableType, exports.typeFromAST = _a.typeFromAST, exports.GraphQLNonNull = _a.GraphQLNonNull, exports.GraphQLObjectType = _a.GraphQLObjectType, exports.visitWithTypeInfo = _a.visitWithTypeInfo, exports.isInputType = _a.isInputType, exports.TypeInfo = _a.TypeInfo;
exports.didYouMean = mod.require("graphql/jsutils/didYouMean")["default"];
exports.suggestionList = mod.require("graphql/jsutils/suggestionList")["default"];
Not sure if this is a proper fix thought cc @alloy
same for me
v1.5.2 has been published, thanks @erictaylor :pray:
Can confirm this has fixed my project with the latest version of the Apollo extension π Thank you so much!
This (normally fantastic) library breaks with the newest release of the Apollo extension:
The root cause seems to be:
From what I can tell this is because the Apollo extension no longer includes
apollo-language-server
as a dependency: