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.

Webpack build error

See original GitHub issue

Very odd but looks like a js file is importing it’s ts version and causing an error, this is probably an issue in my build system.

 ERROR in ./node_modules/apollo-cache-inmemory/src/optimism.ts 1:8
[0] Module parse failed: Unexpected token (1:8)
[0] You may need an appropriate loader to handle this file type.
[0] > declare function require(id: string): any;
[0] | 
[0] | export type OptimisticWrapperFunction<
[0]  @ ./node_modules/apollo-cache-inmemory/lib/optimism.js 1:11-30
[0]  @ ./node_modules/apollo-cache-inmemory/lib/inMemoryCache.js
[0]  @ ./node_modules/apollo-cache-inmemory/lib/index.js
[0]  @ ./node_modules/apollo-boost/lib/index.js
[0]  @ ./src/apolloClient.ts
[0]  @ ./src/_client.tsx

_Originally posted by @rlancer in https://github.com/apollographql/apollo-client/issues/3980#issuecomment-428316959_

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
williambomancommented, Oct 25, 2018

Issue was in my webpack config

  resolve: {
    modules: ['src', 'node_modules'],

I removed ‘src’ and it all worked

resolve: {
    modules: [ 'node_modules'],

If you want to have the former configuration you need to pass an absolute path to your src/ directory, e.g.:

   resolve: {
      modules: [path.resolve(__dirname, 'src'), 'node_modules'],
1reaction
rlancercommented, Oct 10, 2018

Issue was in my webpack config

  resolve: {
    modules: ['src', 'node_modules'],

I removed ‘src’ and it all worked

resolve: {
    modules: [ 'node_modules'],
Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack build error - node.js - Stack Overflow
Strange workaround: I zipped my entire node_modules map and transfered it to PC_A and placed it correctly. Now webpack builds just fine. So...
Read more >
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >
This will make you more efficient at debugging Webpack ...
In this article we'll build a very primitive plugin for Webpack and then I'll show you how to find out if this plugin...
Read more >
next build fails with webpack error #25276 - GitHub
I'm using webpack 4 and started receiving this error today in my monorepo after updating next. Fixed it for now by using "next":...
Read more >
Webpack build error - Questions - Babylon.js Forum
Failed to compile. ./node_modules/@babylonjs/core/Misc/environmentTextureTools.js 100:39 Module parse failed: Unexpected token (100:39) File was ...
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