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.

Can't resolve '@babel/runtime/regenerator' in monorepo

See original GitHub issue

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues

Description

The 4.0.3 version fails with runtime error on npm start (during webpack compilation):

pdfjs-dist/2.1.266/node_modules/pdfjs-dist/lib/web/ui_utils.js
Module not found: Can't resolve '@babel/runtime/regenerator' in '/pdfjs-dist/2.1.266/node_modules/pdfjs-dist/lib/web'

In 4.0.2, adding babel-runtime as a dependency did the trick. Now I’m unable to have it working any other way.

Steps to reproduce

Update from 4.0.2 to 4.0.3. Not reproducible on the sample project.

Expected behavior

I don’t expect a failure.

Additional information

I found some issues talking about a similar error, but nothing on 4.0.3 with no workaround. I tried the webpack entry without any luck.

Environment

  • React-PDF version 4.0.3:
  • React version 16.8.3:
  • Webpack version 4.29.3:
  • Typescript version 3.3.3

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
benabboncommented, Feb 26, 2019

Appreciate your reactivity and thank you for this repository, it’s really cool! I’ll be happy to contribute if need be.

0reactions
benabboncommented, Feb 26, 2019

Thank you @wojtekmaj . As you pointed it to be only a dependency issue when having react-pdf as a third level dependency, I was able to make it work, with adding @babel/runtime as a dependency of the root project (not the cleanest way, but works). I haven’t tried the Provide plugin, but it looks like it would work for me as well, I’ll give it a try as it would be cleaner.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Can't resolve @babel/runtime/helpers
To solve the error "Module not found: Error: Can't resolve '@babel/runtime/helpers'", make sure to install the @babel/runtime package by opening your terminal ...
Read more >
How to fix "Can't resolve '@babel/runtime/regenerator' in npm ...
The temporary fix I found is to npm install --no-save @babel/runtime in the core dependencies repositories, but this get removed each time I...
Read more >
Upgrade to Babel 7
For monorepos we have added a new babel.config.js file that centralizes our config across all the packages (alternatively you could make a config...
Read more >
@babel/runtime | Yarn - Package Manager
:rocket: [New Feature]; :bug: [Bug Fix]; :memo: [Documentation] ...
Read more >
Cannot find module 'babel-runtime/regenerator' Import locally ...
[Solved]-Cannot find module 'babel-runtime/regenerator' Import locally vs Import from NPM-babel.js · the transform plugin babel-plugin-transform-runtime (which ...
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