Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module 'core-js/modules/es6.object.define-property' #69

Open
oreqizer opened this issue Jun 17, 2019 · 16 comments
Open

Cannot find module 'core-js/modules/es6.object.define-property' #69

oreqizer opened this issue Jun 17, 2019 · 16 comments

Comments

@oreqizer
Copy link

Getting

Error: Cannot find module 'core-js/modules/es6.object.define-property'

when running my server.

Installed:

  • core-js@3.1.4
  • react-relay-network-modern@4.0.1

Installing core-js@2.6.9 fixes the issue, but that's an obsolete dependency, would really like to avoid having to use it.

@muntasirsyed
Copy link

Installing core-js@2.6.9 fixes this!

Agree with the above that this should not be the case.

@maraisr
Copy link
Member

maraisr commented Jul 31, 2019

Yes - currently Relay only supports core-js@2. This is not a problem with react-relay-network-modern, but with relay-runtime itself.

@xyy94813
Copy link
Contributor

@oreqizer
If you want to use core-js@v3.x.

The better way is use the lib from es dir:

import { XXX } from 'react-relay-network-modern/es'

@kleinspire
Copy link

import { XXX } from 'react-relay-network-modern/es'

is not an option for me as I'm also using react-relay-network-modern-ssr, which imports from 'react-relay-network-modern/lib'

@taion
Copy link
Member

taion commented Sep 17, 2019

This package needs to either specify an explicit dependency on core-js v2.x. Though in general, it's probably best not to use env with useBuiltIns for libraries regardless.

@nodkz
Copy link
Collaborator

nodkz commented Sep 23, 2019

I'm welcome to any performant solution.

core-js as explicit dependency adds 30kb of code for client bundles: https://bundlephobia.com/result?p=core-js@2.6.9 And I don't feel that it's a good solution.

If you know how to fix this problem, please send a pull request. Tnx.

@taion
Copy link
Member

taion commented Sep 23, 2019

It's a moot point. You're depending on core-js v2 anyway, so those files will get pulled in no matter what.

There's no way to avoid pulling in core-js v2; that code literally won't work without it. And in practice only the modules in use will get pulled in.

@jquense
Copy link

jquense commented Sep 23, 2019

Not including a required dependency doesn't help with bundle size. It's not possible to use this library without core-js, excluding it just means the library is broken by default

@xyy94813
Copy link
Contributor

For this repository, I don't think it needs to consider the runtime-env.
Compatibility issues should be addressed in business project.

A and B project depend on RRNL, A project only need to consider newest browser, but B project user usually use old browser.

Be compatible for every user, it is too difficult.

So, we only need do it: flow => ES or mjs.


If babel-preset-env and useBuiltIns is necessary , we need to output a umd module by webpack.

@jgcmarins
Copy link

I am facing this error: Cannot find module 'core-js/modules/es6.promise'
But only when I try to build. On dev, it works perfectly.

@LaurentHellebrandt
Copy link

Hi guys,
I have a similar problem. I have upgraded from version ^2.1.2 to ^4.3.0. Since then I get the following error messages:

ERROR in ./node_modules/react-relay-network-modern/lib/[filename]
Module not found: Error: Can't resolve 'core-js/modules/es7.symbol.async-iterator' in '/opt/sg/frontend/node_modules/react-relay-network-modern/lib'
...

@simkessy
Copy link

simkessy commented Mar 3, 2020

@jgcmarins did you solve this? I'm facing the same issue where I only get errors in my builds but when I run locally I get no errors. It's very confusing.

@jquense
Copy link

jquense commented Mar 3, 2020

If folks are running into this and don't necessarily need all the nice features in RRNM, we've written and switched to: https://github.com/4Catalyzer/relay-network-layer which is a good bit smaller (at the expense of other features) but still includes, batching and auth

@simkessy
Copy link

simkessy commented Mar 3, 2020

Solved my own problem. I do need core-js:2.6.9 but the issue I was seeing is that webpack would build locally but not in my docker. So I was really confused about that. It turns out locally i'm in a monorepo and the node_modules higher up the chain had the correct dependency. However in docker I only pushed my project so it couldn't a core-js version it needed. This explains why it was working locally but not in docker.

@jgcmarins
Copy link

jgcmarins commented Mar 4, 2020

@simkessy, I am using "core-js": "^3.6.3" and importing stuff from react-relay-network-modern/node8.
check here: https://github.com/FotonTech/golden-stack/blob/74e31d98aa9f6c32cce5acec5664696754cbd6ec/packages/relay-ssr/src/RelayEnvironmentSSR.tsx#L17

@michal-ciechan
Copy link
Contributor

Stupid question, but does relay itself use core-js@2.* still? I was able to use relay without a problem, and when I tried importing from default RRNM package folder project wouldn't compile.

Looks like importing from react-relay-network-modern/es fixes it for me.

I think there should definitely be something in the readme explaining this.

michal-ciechan added a commit to michal-ciechan/react-relay-network-modern that referenced this issue Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests