question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

graphql-language-service ^4.0.0 has invalid dependencies for browser

See original GitHub issue

@acao

I created a small reproduction repo showing the issue: https://github.com/PabloSzx/graphiql-browser-bundle.

Basically:

Doing a browser bundle using esbuild:

esbuild --bundle --platform=browser --outdir=dist index.ts

An error is shown:

✘ [ERROR] Could not resolve "punycode"

    node_modules/.pnpm/markdown-it@12.2.0/node_modules/markdown-it/lib/index.js:14:27:
      14 │ var punycode     = require('punycode');
         ╵                            ~~~~~~~~~~

  The package "punycode" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "--platform=node" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/picomatch@2.3.0/node_modules/picomatch/lib/picomatch.js:3:21:
      3 │ const path = require('path');
        ╵                      ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "--platform=node" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/picomatch@2.3.0/node_modules/picomatch/lib/constants.js:3:21:
      3 │ const path = require('path');
        ╵                      ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "--platform=node" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/picomatch@2.3.0/node_modules/picomatch/lib/utils.js:3:21:
      3 │ const path = require('path');
        ╵                      ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "--platform=node" to do that, which will remove this error.

4 errors
 ELIFECYCLE  Command failed with exit code 1.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
acaocommented, Dec 6, 2021

I’m going to bed soon. They will be improved some day when there is time. You are free to help by proposing any improvements you see fit. Goodnight!

1reaction
acaocommented, Dec 6, 2021

This is the fix for now, I will add an esbuild section to the docs for monaco-graphql with this

{
  "browser": {
    "path": "path-browserify"
  }
}

https://esbuild.github.io/getting-started/#bundling-for-the-browser

Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM warnings when installing @nuxtjs/apollo - Stack Overflow
If you are: not confident with CLI commands; using NPM and not yarn (double check that you don't have any yarn.lock in your...
Read more >
graphql-language-service-interface - npm
This provides the Official Language Server Protocol compliant GraphQL language service to be used by an IDE plugin, a browser application or ...
Read more >
error: cannot find module 'graphql/language/parser' - You.com
I have added "@apollo/client": "3.3.6" (use latest version) as dependency in ... Our mobile browser gives you flexibility to search across different search ......
Read more >
Compare Packages Between Distributions - DistroWatch.com
A complete package list for further comparison is available. ... appcenter-4.0.0 appcsxcad-unstable-2020-01-04 ... asdf-dependency-grovel-20170403-git
Read more >
yarn.lock · equalll/Gatsby - Gitee.com
... dependencies: byte-size "^4.0.3" columnify "^1.5.4" has-unicode "^2.0.1" ... resolve-from "^4.0.0" graphql-language-service-interface@^1.3.2: version ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found