Should include babel runtime with corejs as a regular dependency?
See original GitHub issueIf 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:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to get things working using
mainFields
in my case (yay for small packages with few dependencies!).Great question, I’ll see if I can dig up alternative solutions that could get around this problem.
Thanks for your assistance 😃
I see. They have strict rules about dependencies.
If you can use the code in
src
instead ofdist
, it would always be better. I totally agree that importingreact-hooks-async/src
is not nice.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/1486This 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. 🤔