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.

Using with next.js

See original GitHub issue

I’m not really sure where to report this issue, but basically, the inclusion of Google image imports makes this very difficult to use with next.js (SSR).

When I follow the instructions, I end up getting

Uncaught Error: Module parse failed: node_modules\react-places-autocomplete\dist\images\powered_by_google_default.png Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)

Would you happen to know anything about how to resolve this? All of the existing answers that I’ve seen involve handling images on project code, not external components.

(I personally think that the images shouldn’t really be shipped in the library and should be passed in as a prop or included as inline SVGs instead for retina support, but that’s another issue.)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
lfadescommented, Oct 2, 2017

For the people trying to make the package work with next you have two options:

Stay in the version 5.3.1 or install the package file-loader (or one similar) and then add the following code to your next.config.js file

module.exports = {
  webpack: config => {
    config.module.rules.push({
      test: /\.(png|jpg|gif)$/,
      use: [
        {
          loader: 'file-loader',
          options: {}
        }
      ]
    })

    return config
  }
}
1reaction
hibikencommented, Jan 30, 2018

This won’t be an issue with v6.x or above 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started | Next.js
If you're new to Next.js, we recommend starting with the learn course. The interactive course with quizzes will guide you through everything you...
Read more >
Create a Next.js App | Learn Next.js
Next.js: The React Framework · An intuitive page-based routing system (with support for dynamic routes) · Pre-rendering, both static generation (SSG) and server- ......
Read more >
Setup - Create a Next.js App
You'll be using your own text editor and terminal app for this tutorial. ... the directory you'd like to create the app in,...
Read more >
Basic Features: Pages - Next.js
In Next.js, a page is a React Component exported from a .js , .jsx , .ts , or .tsx file in the pages...
Read more >
What is Next.js?
Next.js is a React framework that gives you building blocks to create web applications. By framework, we mean Next.js handles the tooling and...
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