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.

Should include babel runtime with corejs as a regular dependency?

See original GitHub issue

If you install this library, it may give errors such as this

Module not found: Can't resolve 'core-js/modules/es.array.concat' in '/home/cdiesh/src/jbrowse-components/node_modules/react-hooks-async/dist'   

I believe this is due to not including @babel/runtime-corejs2 as a regular dependency (or maybe @babel/runtime and core-js: 3 as dependencies? not exactly sure)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
durandjcommented, Oct 9, 2019

I was able to get things working using mainFields in my case (yay for small packages with few dependencies!).

I wonder how other “async” libraries solve this problem.

Great question, I’ll see if I can dig up alternative solutions that could get around this problem.

Thanks for your assistance 😃

0reactions
dai-shicommented, Oct 9, 2019

pnpm

I see. They have strict rules about dependencies.

This does work but just looks fishy when I see that as the import path.

If you can use the code in src instead of dist, it would always be better. I totally agree that importing react-hooks-async/src is not nice.

You might be able to configure your bundler to use “module” before “main”?

I’ll see what I can do to make this happen as that sounds like it would make things easier.

I’m not sure which bundler you are using, but webpack doesn’t seem to allow specifying mainFields for specific packages. 😕


One option is to use peerDependenciesMeta and include core-js as an optional peer dependency. Seems like pnpm supports it. https://github.com/pnpm/pnpm/issues/1486

This is going to be a problem for people who use old versions of npm… This is not the best solution either for your case, because the best solution is to use src nicely.

I wonder how other “async” libraries solve this problem. 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/plugin-transform-runtime
A plugin that enables the re-use of Babel's injected helper code to save on codesize. NOTE: Instance methods such as "foobar".includes("foo") will only...
Read more >
If I install both `@babel/runtime-corejs3` do I still need `core-js ...
As title, I'm learning about babel and current I'm trying to understand @babel/plugin-transform-runtime , here are my current conclusions:.
Read more >
@babel/runtime | Yarn - Package Manager
The compiler for writing next generation JavaScript. Gitpod ready-to-code.
Read more >
Read Setting up ES6 | Leanpub
Setting up ES6 projects that are compiled to ES5 via Babel: ... The unit test tool mocha is included as a development-only dependency....
Read more >
The end of @babel/polyfill: The more efficient alternative?
yarn add core-js @babel/core babel-loader @babel/preset-env --dev ... and @babel/runtime are already included as dependencies to your ...
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