optional chaining for graphql-language-service@5.0.0 breaks upstream build
See original GitHub issueHi,
We are using graphiql
module in our app which takes the latest of 1.x.x
version and since upgrading recently to 1.7.1
building graphql-language-service@5.0.0
is failing with the following reason:
16:39:07 Module parse failed: Unexpected token (45:28)
16:39:07 You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
16:39:07 | if (kind === RuleKinds.IMPLEMENTS ||
16:39:07 | (kind === RuleKinds.NAMED_TYPE &&
16:39:07 > state.prevState?.kind === RuleKinds.IMPLEMENTS)) {
16:39:07 | return getSuggestionsForImplements(token, state, schema, queryText, typeInfo);
16:39:07 | }
16:39:07 @ ../node_modules/apiconnect-explorer/node_modules/graphql-language-service/esm/interface/index.js 2:0-45 2:0-45
16:39:07 @ ../node_modules/apiconnect-explorer/node_modules/graphql-language-service/esm/index.js
16:39:07 @ ../node_modules/apiconnect-explorer/node_modules/graphiql/esm/components/GraphiQL.js
16:39:07 @ ../node_modules/apiconnect-explorer/node_modules/graphiql/esm/index.js
16:39:07 @ ../node_modules/apiconnect-explorer/dist/es/components/TestToolGraphQL.js
16:39:07 @ ../node_modules/apiconnect-explorer/dist/es/components/GraphQLDisplay.js
16:39:07 @ ../node_modules/apiconnect-explorer/dist/es/components/Routing.js
16:39:07 @ ../node_modules/apiconnect-explorer/dist/es/App.js
16:39:07 @ ../node_modules/apiconnect-explorer/dist/es/Bootstrap.js
similar issue https://github.com/graphql/graphiql/issues/1852, but we are using webpack 4.x and babel 6.x, so wondering if it is something we need to resolve on our end by doing something like https://danw1ld.medium.com/optional-chaining-for-javascript-with-babel-7-and-webpack-4-2de8fd9dbdd5 to handle optional chaining or it can be resolved from the module itself?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:12 (10 by maintainers)
Top Results From Across the Web
Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called is ...
Read more >Optional chaining breaks build when targeting modern browsers
Bug Report Using the optional chaining operator causes the build to fail when targeting modern browsers through browserslist.
Read more >5 Ways Converting to Optional Chaining Can Break Your Code
The optional chaining operator lets you write concise and safe chains of connected objects when some of those objects can be null or...
Read more >Error while importing a module with optional chaining
We created the project using vue-cli and add the dependency to the library. We then imported a project (Vue Currency Input v2.0.0) that...
Read more >What is wrong with optional chaining and how to fix it - DEV ...
Optional chaining simplifies above and removes a lot of errors by saying that values considered as no value are only two - null...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like we’re still getting the same error on
1.7.2
, withgraphql-language-service "^5.0.1"
🤔every library from this repo that is universal or browser centric should use
target
es6
with typescript by default, which should not include optional chaining, as that is equivalent toes2015
. we only overridetarget
to a later version for the LSP server, vscode-graphql and CLI, so there is something we are doing wrong here