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.

Cannot build with webpack

See original GitHub issue

I’m trying to bundle graphiql which uses codemirror-graphql which uses graphql-language-service.

The build is failing because webpack can’t parse the bundled js.flow files, and it is trying to parse those because of the dynamic import at https://github.com/graphql/graphql-language-service/blob/master/packages/graphql-language-service-interface/src/GraphQLLanguageService.js#L87 (probably) which could be importing anything at all.

Is it not possible to limit the require by making it something like:

require(`./${somePath}.js`)

?

If not, is it possible to not include the flow js files in the dist folder?

The webpack error is:

Module parse failed: .../node_modules/graphql-language-service-interface/dist/getOutline.js.flow Unexpected token (11:12)
You may need an appropriate loader to handle this file type.
|  */
|
| import type {
|   Outline,
|   TextToken,
 @ ./node_modules/graphql-language-service-interface/dist ^.*$
 @ ./node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js
 @ ./node_modules/graphql-language-service-interface/dist/index.js
 @ ./node_modules/codemirror-graphql/lint.js
 @ ./node_modules/graphiql/dist/components/QueryEditor.js
 @ ./node_modules/graphiql/dist/components/GraphiQL.js
 @ ./node_modules/graphiql/dist/index.js
 @ ./lib/universal/Graphql/index.jsx
 @ ./lib/universal/Root.jsx
 @ ./lib/client/index.js
 @ multi babel-polyfill stratokit/client

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:24
  • Comments:31 (19 by maintainers)

github_iconTop GitHub Comments

12reactions
wmertenscommented, Jul 19, 2017

For now I worked around it by using this as a webpack plugin:

			new webpack.ContextReplacementPlugin(
				/graphql-language-service-interface[\\/]dist$/,
				new RegExp(`^\\./.*\\.js$`)
			)

but of course this is far from ideal. Isn’t there a better approach than this dynamic require?

9reactions
iglcommented, Mar 15, 2019

How is this still thing? geez

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Build in Webpack without odd error - Stack Overflow
I'm using Webpack to build a very simple, small tutorial with ReactJS and JSX code. I'm getting an error I don't understand.
Read more >
Cannot build webpack example for production #2266 - GitHub
Hi, I am trying to build the deck.gl react-webpack-2 get-started example for production and I am running into the following issue: Actual ...
Read more >
Webpack 5 Adoption - Next.js
Using webpack 5 in your application has many benefits, notably: Improved Disk Caching: next build is significantly faster on subsequent builds ...
Read more >
compression-webpack-plugin - npm
Prepare compressed versions of assets to serve them with Content-Encoding. Latest version: 10.0.0, last published: 7 months ago.
Read more >
Webpack 5 errors | ImmutableX Documentation
The reason for this error is that create-react-app uses a version of webpack greater than 5, which, unlike versions < 5, does not...
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